I thought it worth posting a lesson learned for everyone’s benefit.
Scenario
· You are developing an intra-day strategy, which uses daily data.
· You need to ensure you have sufficient data to prime indicators on the daily data – e.g. SMA(14).
I’ve recently been working with an intra-day strategy which uses daily data as an input. I have been using the multi-time frame method and backtesting across historical data:
http://www.ninjatrader-support.com/HelpGuideV6/MultiTimeFrameInstruments.html
http://www.ninjatrader-support.com/HelpGuideV6/HistoricalData.html
(N.B. daily data is treated differently than tick or minute data.)
Solution
(Assumes you have lower timeframe data in initial BarsArray[0] position. And daily data in the BarsArray[1] position.)
I have recently found something with the daily data BarsArray. When calling this in a backtest, the BarsArray is actually filled at the start of the backtest – I suspect from the Initialise() function. This means that if you use:
[COLOR=blue][FONT=Courier New]if[/FONT][/COLOR][COLOR=black][FONT=Courier New] (BarsArray[[/FONT][/COLOR][COLOR=purple][FONT=Courier New]1[/FONT][/COLOR][COLOR=black][FONT=Courier New]].Count > [/FONT][/COLOR][COLOR=purple][FONT=Courier New]14[/FONT][/COLOR][COLOR=black][FONT=Courier New])[/FONT][/COLOR] [COLOR=blue][FONT=Courier New]return[/FONT][/COLOR][COLOR=black][FONT=Courier New];[/FONT][/COLOR]
Therefore, you should use:
[COLOR=blue][FONT=Courier New]if[/FONT][/COLOR][COLOR=black][FONT=Courier New] (BarsArray[[/FONT][/COLOR][COLOR=purple][FONT=Courier New]1[/FONT][/COLOR][COLOR=black][FONT=Courier New]].CurrentBar < [/FONT][/COLOR][COLOR=purple][FONT=Courier New]14[/FONT][/COLOR][COLOR=black][FONT=Courier New]) {[/FONT][/COLOR]
[COLOR=blue][FONT=Courier New]return[/FONT][/COLOR][COLOR=black][FONT=Courier New];[/FONT][/COLOR]
[COLOR=black][FONT=Courier New]}[/FONT][/COLOR]
Could someone from NT support confirm the above statements are correct?
Kind regards,
Dan

Comment