1) at the top of the strategy declare the three element series array OHLC4s:
private Series<double> [ ] OHLC4s = new Series<double>[3];
2) in State.Configure add two additional time series to the strategy:
else if (State == State.Configure)
{
AddDataSeries(BarsPeriodType.Second, 30); // BarsArray Index 1
AddDataSeries(BarsPeriodType.Second, 60); // BarsArray Index 2
}
3) within State.DataLoaded add the following lines:
else if (State == State.DataLoaded)
{
OHLC4s[0]= new Series<double>(BarsArray[0]); // Synced to BarArray[0]
OHLC4s[1]= new Series<double>(BarsArray[1]); // Synced to BarArray[1]
OHLC4s[2]= new Series<double>(BarsArray[2]); // Synced to BarArray[2]
}
4) Finally, within OnBarUpdate define the the custom series:
OHLC4s[0][0] = 0.25 * (Opens[0][0] + Highs[0][0] + Lows[0][0] + Closes[0][0]) ;
OHLC4s[1][0] = 0.25 * (Opens[1][0] + Highs[1][0] + Lows[1][0] + Closes[1][0]) ;
OHLC4s[2][0] = 0.25 * (Opens[2][0] + Highs[2][0] + Lows[2][0] + Closes[2][0]) ;
Is this the correct way to set up a custom array of time series? Would I then be able to call any of the three data series by its index such as OHLC4s[2]? For example, SMA(OHLC4s[2], 10), etc?
Do I need to do anything else or should I do something differently than what is outlined above?
Thank you very much for your input/advice.

Comment