Support Board
Date/Time: Tue, 24 Mar 2026 01:18:17 +0000
Question about sc.VolumeAtPriceForBars
View Count: 12
| [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-23 23:44:38] |
| Tony - Posts: 699 |
|
I found a solution, I have a new input to turn on and off offset, if there is no gap or trading below the gap, offset is off, otherwise, I will have a offset value by comparing the size difference of total levels of the session vs. total levels sc.VolumeAtPriceForBars gives me.
|
| [2026-03-24 00:54:15] |
| Tony - Posts: 699 |
|
Problem solved, please ignore my previous 2 messages, 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; } |
To post a message in this thread, you need to log in with your Sierra Chart account:
