• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar referencing back testing vs forward testing

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

    Bar referencing back testing vs forward testing

    A couple of questions regarding taking some strategies live/forward testing.

    Strategies are set to OnEachTick.

    When referencing a bar index on multi-timeframe strategies, Lows[1][0] in back test is referencing the last closed bar of data series 1. When going live, I assume this will need to be altered to Lows[1][1]?

    Similarly, referencing MIN(low,3)[1] in back testing will turn into MIN(low,3)[2] on live?

    Also, I'm assuming the setting for slippage (which I have set for back testing) doesn't apply when forward testing with live data? Or do I have to set slippage to 0?

    Lastly, is there some best practice for automatically altering these values when backtesting/forward testing so as to not have to manually change them every time I switch between the two modes?

    #2
    Hello pmn100,

    Thanks for your post.

    Correct, your references would need to shift when going from State.Historical to State.Realtime if you are using Calculate.OnEachTick.

    Slippage applies only to the historical trades so no need to do anything there.

    You could use State.Realtime to configure an "offset" value. For example if (State==State.Realtime) offset = 1; where offset is an int that is initialized to 0.
    thus: Lows[1][offset] would work in both arrangements.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the response. So I'd set "offset" in the State.SetDefaults to 0 and then to 1 in State.Realtime? Is it possible to add this offset to current bar index values rather than replacing like in your example?

      i.e. Lows[1][0+offset] Just that some bars that are current referencing [1] would need to go to [2] etc.

      Sorry not at my computer to test right now.

      Comment


        #4
        Hello pmn100,

        Thanks for your reply.

        You can check for the state in the OnBarUpdate() and then adjust the offset as you wish. (This was my thinking when I wrote checking if (state==...)).
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bchip, Today, 09:25 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Tomass, Today, 09:25 AM
        2 responses
        11 views
        0 likes
        Last Post Tomass
        by Tomass
         
        Started by hundert, Today, 08:37 AM
        3 responses
        17 views
        0 likes
        Last Post NinjaTrader_Melissa  
        Started by ronaldgreene828, Today, 08:16 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by hir04068, Today, 01:36 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Working...
        X