Login Page - Create Account

Support Board


Date/Time: Tue, 24 Mar 2026 02:59:07 +0000



Post From: Question about sc.VolumeAtPriceForBars

[2026-03-23 23:18:20]
Tony - Posts: 699
ACSIL Interface Members - Variables and Arrays: sc.VolumeAtPriceForBars

I have a custom study that store volumes of each level for current session in a array, the size of the array is MyArray[(DaysHigh-DaysLow)/TickSize], if I need to access Volume of current level, I just need to do this: MyArray[(sc.Close[sc.Index]-DaysLow)/TickSize]

Everything works great until today. This morning, due to the volatility of the market, VbP has a gap in 6562.50 - 6571.50 range (roughly), so the sc.VolumeAtPriceForBars skipped those levels, and the size of the array is 36 levels short, and I wasn't able accurately get the number of volume, unless, I temporarily modify the code to fetch the number that is 36 ticks lower.

I tried to modify the sample code as such:
const s_VolumeAtPriceV2 *p_VolumeAtPrice=NULL;
int VAPSizeAtBarIndex = sc.VolumeAtPriceForBars->GetSizeAtBarIndex(sc.Index);
for (int VAPIndex {0} ; VAPIndex<VAPSizeAtBarIndex; VAPIndex++) {
    if (!sc.VolumeAtPriceForBars->GetVAPElementAtIndex(sc.Index, VAPIndex, &p_VolumeAtPrice))
      ProfileValues[VAPIndex] = 0;
    else
      ProfileValues[VAPIndex] = p_VolumeAtPrice->Volume;
}

but it didn't work, wonder if there is a way to get around this?

Thanks so much!