Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change Data Series in Backtesting

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

    Change Data Series in Backtesting

    Hi,
    I'm using NT7, and I would like to backtest a strategy over 5 years, using daily data from yahoo.

    The default data series is loaded with only 365 days.

    When I'm testing it on a chart, I can access the Data Series [Ctrl+F] and change 365 to 2000 which is 5 years+ of data, and everything is fine.

    However, when I try to do the same backtest in the Strategy Analyzer screen [with the list of instruments on the left], I can't modify this parameters and all my backtests are done on 1 year only.

    Is there a way to modify it?

    Also, is there a way to change the default from 365 to 2000?

    Thanks.

    #2
    Hello gogetit,

    Welcome to the NinjaTrader forums!

    This is controlled with the From and To dates when you backtest a strategy.

    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Oh, I can't believe I missed that. Thanks!

      Another question, is it possible to hook somehow to the export mechanism?

      Reason is, I would like to run the same strategy over 50+ different instruments, and I would like to compare the results. The best way for me to do that would be to export everything to the same CSV file or something similar. Is it possible to that somehow?

      Comment


        #4
        Yes, you can custom program this. These reference samples can help with writing information to a file.

        Using StreamWriter to write to a text file - also applicable to strategies
        Using System.IO File properties to write to and read from a text file

        What you may prefer doing instead is running the backtest against a group of instruments, and then you can view reports for each instrument in the list. If you'd like to get any of this information exported to a file, this is done with the right click > Grid > Save as option.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Yes, that's exactly what I need, the question is can I access the backtest results directly or must I export trade-by-trade [from my strategy code] and calculate the results myself.
          Thanks again for the prompt replies.

          Comment


            #6
            If you wanted to export from the strategy to a file, this must all be manually calcualted. Please see the performance class for help getting this type of information.


            The only way to access the NinjaTrader backtesting report is within the gui.
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              Okay, great, I can defiantly work with that, so my last question is, how can I tell in the strategy class, that this is the most recent bar, so I could perform all the calculation and export right before exit?

              Thanks.

              Comment


                #8
                This is not supported code, but you can use:

                if (CurrentBar == Bars.Count -2)
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Yeah, that's exactly how I'm doing it now. I just finished running the code:

                  System.IO.File.AppendAllText(path, CurrentBar + ","+Bars.Count+Environment.NewLine);


                  So I figured it out.

                  Thanks again for all the help. It's great that my first question was just few hours ago, and you were able to answer quite few of them since.

                  Comment


                    #10
                    My pleasure, gogetit. Thank you for the kind words.
                    Ryan M.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by aussugardefender, Today, 01:07 AM
                    0 responses
                    3 views
                    0 likes
                    Last Post aussugardefender  
                    Started by pvincent, 06-23-2022, 12:53 PM
                    14 responses
                    238 views
                    0 likes
                    Last Post Nyman
                    by Nyman
                     
                    Started by TraderG23, 12-08-2023, 07:56 AM
                    9 responses
                    384 views
                    1 like
                    Last Post Gavini
                    by Gavini
                     
                    Started by oviejo, Today, 12:28 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post oviejo
                    by oviejo
                     
                    Started by pechtri, 06-22-2023, 02:31 AM
                    10 responses
                    125 views
                    0 likes
                    Last Post Leeroy_Jenkins  
                    Working...
                    X