The idea is to increment a variable when there are 2 trades above the ask or below the bid and increment a second variable if there are 8 or 10 trades above the ask or below the bid.
I know I need to use MarketDataType.Ask and MarketDataType.Last and e.Price but what I have put together so far is not working.
I don't mind using COBC and just DrawText and mark the bar AA for AboveAsk or BB for BelowBid. This way I can incorporate in an existing strategy that uses COBC. If I have to create a separate strategy where COBC is false, I'm ok with that too and actually I probably should do this because I want to know right away when this happens.
Here is the last code I tried but it doesn't work, any help with this would be most appreciated !
/* The below condition is not working, figure it out
protected override void OnMarketData(MarketDataEventArgs e)
{
if (e.MarketDataType == MarketDataType.Ask)
{
CurrentAsk = e.Price;
}
if (e.MarketDataType == MarketDataType.Last && Close[0] > CurrentAsk)
{
TradeAboveAsk++;
}
if (e.MarketDataType == MarketDataType.Last && e.Price < GetCurrentBid())
{
TradeBelowBid++;
}
}
*/

Comment