Below you can find a simplified version of my code.
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
this.LookbackPeriod = 20000;
}
else if (State == State.Configure)
{
AddDataSeries(Instrument.FullName, BarsPeriod, (this.LookbackPeriod + base.Bars.Count), Instrument.MasterInstrument.TradingHours.Name, null);
}
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 0) // Initial data series
{
}
if (BarsInProgress == 1 && State == State.Historical)
{
// Normally this will be triggered x times (duration of lookbackperiod) before BarsInProgress will be 0
}
}

Comment