Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Back Testing - Accessing the From and To Dates

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

    Back Testing - Accessing the From and To Dates

    Hi

    Is it possible to access the From and To dates specified as parameters to a backtest from the strategy?

    I want to use these dates to form part of my log file name.

    Any help will be much appreciated.
    Many Thanks
    Lloyd

    #2
    Lloyd, unfortunately this is unsupported.
    AustinNinjaTrader Customer Service

    Comment


      #3
      You can trace the from day from the first bar in OnUpdate() and the end date from the last bar.

      Baruch

      Comment


        #4
        Hi Baruch
        Many thanks for your reply. I am setting my logs files up in the initialise , can you think of any way to do this?
        best regards
        Lloyd

        Comment


          #5
          Hi Lloyd,
          First - why in initialize?
          Second - then rename on the last bar.

          Baruch

          Comment


            #6
            Hi Baruch

            I first backup my logs from the previous execution and set up new ones in Initialise, as I only need to do this once per execution I figured Initialise was the best place for it. I guess I could move this to OnBArUpdate and add some additional checks to stop it running each time,
            thanks again for your assistance, much appreciated
            regards
            Lloyd

            Comment


              #7
              Lloyd, is it recommended to keep as little code in Initialize() as possible because Initialize() gets called all the time in the normal course of NinjaTrader activities, thus executing extra code unnecessarily.

              Instead, you can put it in:
              Code:
              OnBarUpdate()
              {
                 if (CurrentBar == 0)
                 {
                    // this block of code will run at the very beginning of the indicator/backtest being run
                 }
              }
              AustinNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              576 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              334 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              553 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              551 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X