I have a muli time frame strategy that communicates with an indicator. When I back test it, it communicates with the indicator just fine executes trades as expected. I just tried using the Market Replay feature and I am getting some unexpected results. I was wondering if someone could take a look at my code to see if this is the correct way of implementing the communication between strategy and Indicator or if anyone has had trouble testing there strategy with market replay.
First off just so you're aware, the first two Add(Indicator()) statements are only needed if you want the [visual] indicator to be displayed on the performance results chart.
But your odd behavior is possibly because your if conditions are being applied to each time frame instead of one.
Meaning you'll want to do something like this:
BarsInProgress == 0 or BarsArray is the primary time frame which is set from the NT GUI. You would reference those other time frames individually using BarsArray "from within" this primary time frame if using the code above or you would need to reference them using BarsInProgress/BarsArray.
Its been suggested to set your trade execution time frame to 1 second for backtesting purposes or a minimum of 1 minute if you only have minute data and not tick data.
Thanks for the reply MrYou. I am currently checking for BarsInProgress including returning on BarsInProgress==0. The problem I am seeing is at around 5:30am on the ES, I should be getting a buy signal from my indicators and go long. When I backtest, this is what happens. When I use market replay, I get a short signal and I go short. This is very confusing and frustrating for me. My only conclusion is that there is something wrong with Market Replay as my code I believe is sound.