Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest data compared to real time SMA question

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

    Backtest data compared to real time SMA question

    I noticed that If I change my dates in the back test it will change which trades my strategy will take. For instance, in my trading strategy I am not taking trades when the 200 MA is too far from price. So if there is a big gap over night and I have set my dates to exclude the overnight session in my back test then the strategy will take the trade because now the SMA is now close to price. However, if I include the previous day - which accounts for the gap in price, then I my strategy doesn't take the trades, because of the difference in price and the 200 SMA. So my question is this how would this strategy perform in real time? Since it uses historical data and real data, my fear is that the SMA wouldn't be calculated correctly and that it would reset daily.

    So if I stopped the strategy at the end of the day and started it again the next morning. Wouldn't it be missing the data it needs to trade correctly? I do have maximum bar lookback set to 256 so I would have thought this would be able to account for this. I may also change my bars required to trade to 200, but wouldn't that just mean if I started my strategy every morning that it would need 200 bars to trade?

    In short, how can I be sure my strategy will properly calculate the SMA to include previous day prices if I restart the strategy.

    Thanks!

    #2
    Hello, thanks for your post. The SMA needs a certain amount of days, so load that many days in the Data Series menu. You can load data based on the date, bar number, or a fixed date range in the data series menu. You can also use Print() in your strategy to see the data being used by the strategy.

    Comment


      #3
      What do you mean by this "so load that many days in the Data Series menu"?

      Comment


        #4
        Hello, thanks for the follow up. It means to load as much data as is needed. A 200 Period SMA needs at least 200 historical bars to calculate, so make sure that at least 200 bars of data are loaded.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        560 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        325 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
        547 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X