I am trying to code an indicator signalling when a bid - ask imbalance occurs and I'm not sure I understand which of the two codes below I should use in what situation
Thank you
protected override void OnBarUpdate()
{
currentAsk = GetCurrentAsk();
currentAskVolume = GetCurrentAskVolume();
.........
}
protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
{
if (marketDataUpdate.MarketDataType == MarketDataType.Ask)
{
askVol = marketDataUpdate.Volume;
currentAsk = marketDataUpdate.Price;
}
}

Comment