This is just an exercise where I'm trying to figure how to work with timings between bars, in both backtesting and live, and I'm stuck on backtesting.
I'd like to understand how to evaluate daily bar closes between 2 periods, for instance:
if ( Close(365) > Close(0) )
When I run a backtest on ES 09-23, I get an index out of range error.
So I tried loading another data set.with 400 bars of history (I think)...
else if (State == State.Configure) { AddDataSeries("ES 09-23",new BarsPeriod { BarsPeriodType = BarsPeriodType.Day, Value = 1 },400,"US Equities RTH" , null); }
Then with this evaluation
if ( Close[0]>Closes[1][365] )
still getting the index out of range on the backtest.
How should this be implemented, any help greatly appreciated.
Regards

Comment