**NT** Error on calling 'OnMarketData' method for strategy 'TestStrategyOnMarketData/58f61913f4884c2ba124fabc8b57cd92': You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
May be OnMarketData is accesing the value too soon when OnMarketDepth() has not produce that value yet. How to overcome that?
protected override void OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.Last)
{
tradePrice = e.Price;
tradeQty = e.Volume;
}
if (e.MarketDataType == MarketDataType.Ask)
{
askPrice = e.Price;
askQty = e.Volume;
}
if (e.MarketDataType == MarketDataType.Bid)
{
bidPrice = e.Price;
bidQty = e.Volume;
}
Print(bidRows[1].Volume);
}

Comment