I've added a second instrument, and used "BarsInProgress" to parse out the bid-asks. Can you tell what is wrong? It works if I remove the "if(BarsInProgress ==0)", but that defeats the ability to get the bid-asks of each instrument separately.
protected override void Initialize()
{
Add(Symbol2, BarsPeriod.Id, BarsPeriod.Value);
}
protected override void OnMarketData(MarketDataEventArgs e)
{
if (e.MarketData.Ask == null || e.MarketData.Bid == null)
return;
if (BarsInProgress == 0) {
double aAsk=e.MarketData.Ask.Price;
double aBid=e.MarketData.Bid.Price;
}
SpreadHigh.Set( Qty1* aAsk ); // throws error "The name 'aAsk" does not exists in the current context"
SpreadLow.Set( Qty1* aBid ); // throws error "The name 'aBid" does not exists in the current context"
Comment