Login Page - Create Account

Support Board


Date/Time: Tue, 24 Mar 2026 02:58:54 +0000



Question about sc.VolumeAtPriceForBars

View Count: 20

[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!
[2026-03-24 00:54:15]
Tony - Posts: 699
Problem solved, please ignore my original message, Thanks!

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))
      break;
    double ActualPrice = p_VolumeAtPrice->PriceInTicks * sc.TickSize;
    int TargetIndex {(int)((ActualPrice-ProfileRange[0])/sc.TickSize)};
    ProfileValues[TargetIndex] = p_VolumeAtPrice->Volume;
}

Date Time Of Last Edit: 2026-03-24 02:28:27

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account