Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest Runs for One Day Only

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

    Backtest Runs for One Day Only

    Hi All,

    Another newbie question from yours truly.

    I programmed a strategy and it runs beautifully (or at least as it should run). My only problem is that it only runs for one day when I do the backtest. If I set the backtesting period to 5 days, it will only give me the results of the first day. Any ideas on how to tell the script to reset itself on the next trading day?

    Thank you in advance for your help!!!

    #2
    Hello GeoOrtiz,

    Thank you for your post.

    Do you have data for all 5 days you are running the Backtest on?

    You can check this by going to the NinjaTrader Control Center > Tools > Historical Data Manager > Edit > select the instrument > Last > then the period type (Tick, Minute or Day) > do you see data for the dates you are Backtesting on?

    I look forward to your response.

    Comment


      #3
      Hello PatrickH,

      Yes, I'm running the test on the ES for last week connected to Kinetick (see image attached).
      Attached Files

      Comment


        #4
        Hello GeoOrtiz,

        Thank you for that information.

        After running a backtest on your strategy do you see any errors in the Log tab of the NinjaTrader Control Center?

        Do you see the same behavior when running a backtest on the same dates and period type for the same instrument but using the SampleMaCrossOver strategy?

        I look forward to your response.

        Comment


          #5
          No, no error on the Log tab.

          The SampleMaCrossOver strategy works fine.

          The problem must be in the code. Is there a command that I can include that resets all variables on the next trading day?

          Comment


            #6
            Hello GeoOrtiz,

            Thank you for that information.

            You will need to manually code in the reset of any variables.

            Such as the following:
            Code:
            if(Bars.FirstBarOfSession)
            {
            myInt = 0;
            myBool = false;
            // etc...
            }
            This would set the variables myInt and myBool as defined above on the first bar of each session (first bar of the day).

            For information on Bars.FirstBarOfSession please visit the following link: http://www.ninjatrader.com/support/h...rofsession.htm

            Please let me know if I may be of further assistance.

            Comment


              #7
              Thank you PatrickH. That was the answer to my problem.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              573 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X