Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Portfolio performance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Portfolio performance

    Hi

    I want to check the performance of a portfolio of stocks using different stop criteria.

    What are the options for creating the list of stocks?

    Creating a data series for say 30 stocks seems a very clumsy way to go about it.

    I want to hold the same stocks, but would buy / sell periodically so need to lookup closing prices for various dates.

    Thanks for any pointers.

    Ian

    #2
    Hello Ianc28,

    Thanks for your message.

    You could create an Instrument List comprising of your stocks. The Instrument List can then be conveniently loaded into a Market Analyzer to see the Last Price or the Last Close of each stock.

    Instrument Lists can also be used in the Strategy Analyzer to give a basket test of those instruments with your particular strategy. I.E. if you have a few different strategies defining your stop criteria, you could run a basket test of those strategies against you instrument list to see the trade performance from tha backtest.

    If you have any additional questions, could you elaborate on your intentions and your goals so we can provide further insight?

    Working with Instrument Lists - https://ninjatrader.com/support/help...ment_lists.htm

    Basket tests - https://ninjatrader.com/support/help...asket_test.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      Thanks for your suggestion.

      I can see that using Market Analyzer will allow the strategy to process each stock individually, but I want to evaluate the performance of the portfolio as a whole, so I would have to write the individual results to a file and then process the individual result files.

      Part of the process may include a re-balancing of the number of shares held in the portfolio at various stages depending on the performance of the individual stock, so the whole portfolio should really be held in memory.

      Is there a way to incorporate the Market Analyzer in the strategy so that Close values can be looked up and processed within the calculations used by the strategy?

      Thanks again

      Ian

      Comment


        #4
        Hello Ian,

        Thanks for your reply.

        I can see that using Market Analyzer will allow the strategy to process each stock individually, but I want to evaluate the performance of the portfolio as a whole, so I would have to write the individual results to a file and then process the individual result files.
        You could create your own Market Analyzer column that writes this information to a file so it can be read at a later by your strategy, or you could consider writing the information to static variables in an AddOn that the strategy then reads.

        Part of the process may include a re-balancing of the number of shares held in the portfolio at various stages depending on the performance of the individual stock, so the whole portfolio should really be held in memory.
        Writing the information to static variables in an AddOn would keep the values in memory, but we are beginning to get into unsupported territory for how this could be worked into a solution for your needs. I'm not sure how you plan to do the rebalancing, and it may take some experimentation to be able to perform the rebalancing when it is needed as the backtest is performed.

        Is there a way to incorporate the Market Analyzer in the strategy so that Close values can be looked up and processed within the calculations used by the strategy?
        The best suggestion I would have would be to create your own Market Analyzer Columns that store this information in an AddOn or have the values written to file so they can be parsed by the strategy.

        An example for storing variables in an AddOn so the values can shared between scripts is linked below.



        MarketAnalyzerColumn documentation can be found here - https://ninjatrader.com/support/help...zer_column.htm

        Example indicators that incorporate a StreamWriter and StreamReader can be found below.

        SampleStreamReader - https://ninjatrader.com/support/help...o_read_fro.htm

        SampleStreamWriter - https://ninjatrader.com/support/help...o_write_to.htm

        I look forward to being of further assistance.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        4 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        40 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by Kaledus, Today, 01:29 PM
        5 responses
        15 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X