Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

step by step test for a strategy

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

    step by step test for a strategy

    Hi, I need some help
    My strategy starts in M60 then - after the break even - switch M5 time line. Is there an opportunity to make test "step by step" or "candle by candle"? I mean that the test run on historical data, but I could add the next bar. What would be the best test method in this case, when the time line is switched?
    Thank you for your help

    best regards
    Akos

    #2
    Hello,

    I'm not 100% certain on exactly what you are looking for, but I can offer a few points. If you would like to switch between using a 60-minute and 5-minute interval in your code, you can do so by adding a secondary data series to the script. If you are running the script on the 60-minute interval, for example, then you could add a 5-minute data series, of the same instrument. Then you could differentiate between which data series is calling OnBarUpdate() at a given time by checking for BarsInProgress == 0 or BarsInProgress == 1.

    If you need to precisely compare one bar to another, there are two keys that will help. One will be ensuring that you are using sequential bar indexes when comparing bars (Close[3] and Close[4], as an example). Also, keep in mind that you can check the value of CurrentBar at any time to determine exactly which bar in the series you are analyzing, even on historical data.

    For more information about adding data series, please see the link below, and please let me know if I am not understanding your question fully.

    http://www.ninjatrader.com/support/h....html?add3.htm
    Dave I.NinjaTrader Product Management

    Comment


      #3
      Hi Dave, thank you for your answer. Yes, my script contains the mentioned lines. And the script runs real time. But this way is to slow for test: I would like to see, what does the program do candle by candle: the program starts, gets the first candle. After the process, I see, for example, that the stop loss was increased. Then I enable the processing of the next bar. (For example I push F12 button) And so. There is an opportunity to run this kind of test of a script? (The back test is not good for me, because of the difference of bar building from historical and real time data)

      best regards
      Akos

      Comment


        #4
        Originally posted by akkiss View Post
        Hi Dave, thank you for your answer. Yes, my script contains the mentioned lines. And the script runs real time. But this way is to slow for test: I would like to see, what does the program do candle by candle: the program starts, gets the first candle. After the process, I see, for example, that the stop loss was increased. Then I enable the processing of the next bar. (For example I push F12 button) And so. There is an opportunity to run this kind of test of a script? (The back test is not good for me, because of the difference of bar building from historical and real time data)

        best regards
        Akos
        Use market replay?

        Comment


          #5
          Yeees, this will be the solution!!! I forgot it.
          Thanks a lot, have a nice day
          Akos

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          574 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          333 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