if you use the Plot method inside of OnMarketData, the MarketReplay crashes when is rewinded to the begining.
Only occurs with multi-instrument. With one single instrument works ok.
If you don't rewind, no crashes.
The code:
protected override void Initialize()
{
Add( "$GBPUSD", BarsPeriod.Id, BarsPeriod.Value ); // Instrumento secundario: GBPUSD
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "Plot1"));
CalculateOnBarClose = false;
Overlay = false;
BarsRequired = 20;
}
protected override void OnMarketData( MarketDataEventArgs e )
{
switch (BarsInProgress)
{
case 0:
Plot0.Set(Close[0]);
break;
case 1:
Plot1.Set(Close[0]);
break;
}
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
}

Comment