I'm trying to access the total levels in a Volumetric Bar by but it's giving me an error.
int priceLevels = barData.GetPriceLevelCount(CurrentBar);
double askVolCurrent = barData.GetAskVolumeForPrice(CurrentBar, i); double bidVolBelow = barData.GetBidVolumeForPrice(CurrentBar, i - 1);
long currentBarLong = CurrentBar;
var barData = barsType.Volumes[currentBarLong];
if (barData == null)
return;
int priceLevels = barData.GetPriceLevelCount(CurrentBar);
for (int i = 1; i < priceLevels; i++)
{
double askVolCurrent = barData.GetAskVolumeForPrice(CurrentBar, i);
double bidVolBelow = barData.GetBidVolumeForPrice(CurrentBar, i - 1);
if (bidVolBelow > 0 && askVolCurrent / bidVolBelow >= ImbalanceRatio)
{
Draw.Text(this, $"BuyImb_{CurrentBar}_{i}", "⬆", 0, barData.GetPriceForPriceLevel(CurrentBar, i), Brushes.Lime);
}
double bidVolCurrent = barData.GetBidVolumeForPrice(CurrentBar, i);
double askVolAbove = barData.GetAskVolumeForPrice(CurrentBar, i - 1);
if (askVolAbove > 0 && bidVolCurrent / askVolAbove >= ImbalanceRatio)
{
Draw.Text(this, $"SellImb_{CurrentBar}_{i}", "⬇", 0, barData.GetPriceForPriceLevel(CurrentBar, i), Brushes.Red);
}
}

Comment