Login Page - Create Account

Support Board


Date/Time: Thu, 13 Nov 2025 02:57:05 +0000



Data calculation by every tick

View Count: 488

[2025-08-08 12:28:52]
User358514 - Posts: 14
Hey!

I am working on a study which analyzes the delta(ask-bid) volume dynamics inside of a bar.
What is the most efficient(performance approach) way to analyze the tick-by-tick data inside of a bar?
The chatgpt says there is a "sc.NewVolume" variable, but I can't find any info about it, and it isn't in the headers(at least in my version).

Thanks
[2025-08-11 11:01:23]
DFromeaux - Posts: 22
Hi,

I think the best way to do this is to access the intrabar volume using the function:

sc.VolumeAtPriceForBars

This way, you can retrieve the Bid and Ask for each price and either calculate the delta per price level for each bar or sum all the bids and all the asks to calculate the delta for the entire bar.

Here is the documentation: ACSIL Interface Members - Variables and Arrays: sc.VolumeAtPriceForBars
[2025-08-11 17:00:43]
Sierra_Chart Engineering - Posts: 21378
Yes post #2 is good information.

Not sure what else we can suggest without knowing the precise details of the calculations you need to do.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2025-08-11 17:00:51
[2025-09-01 11:40:05]
User358514 - Posts: 14
Hey again,

I started to test an approach which fits the target drafted above.
I use manual looping and the code below getting called on every study call.

if(index >= sc.ArraySize-1) {
// Get the Time and Sales
c_SCTimeAndSalesArray TimeSales;
sc.GetTimeAndSales(TimeSales);
int TimeSalesSize = TimeSales.Size();

int BeginIndex = 0, EndIndex = 0;
sc.GetTimeSalesArrayIndexesForBarIndex(index, BeginIndex, EndIndex);
SCString DebugString;
DebugString.Format("Time and Sales index = %d, BeginIndex = %d, EndIndex = %d", index, BeginIndex, EndIndex);
sc.AddMessageToLog(DebugString, 0);

DebugMessage.Format("ts size: %d", TimeSalesSize);
sc.AddMessageToLog(DebugMessage, 0);

if (TimeSalesSize == 0)
return; // No Time and Sales data available for the symbol

// Loop through the Time and Sales
int OutputArrayIndex = sc.ArraySize;
uint32_t AskVolume=0, BidVolume=0, Volume=0;
for (int TSIndex = BeginIndex; TSIndex <= EndIndex; TSIndex++)
{
s_TimeAndSales TimeAndSalesRecord = TimeSales[TSIndex];
TimeAndSalesRecord *= sc.RealTimePriceMultiplier;
AskVolume += TimeAndSalesRecord.AskSize;
BidVolume += TimeAndSalesRecord.BidSize;
Volume += TimeAndSalesRecord.Volume * sc.MultiplierFromVolumeValueFormat();
//float Volume = TimeAndSalesRecord.Volume * sc.MultiplierFromVolumeValueFormat();

TimeAndSalesRecord.DateTime.GetDateTimeYMDHMS(tickYear, tickMonth, tickDay, tickHour, tickMinute, tickSecond);
DebugMessage.Format("tick data: %d-%d-%dT%d:%d:%d - %d - %d - %d", tickYear, tickMonth, tickDay, tickHour, tickMinute, tickSecond, AskVolume, BidVolume, Volume);
sc.AddMessageToLog(DebugMessage, 0);
}
sc.BaseDateTimeIn[index].GetDateTimeYMDHMS(tickYear, tickMonth, tickDay, tickHour, tickMinute, tickSecond);
DebugMessage.Format("bar data: %d-%d-%dT%d:%d:%d - %d - %d - %d", tickYear, tickMonth, tickDay, tickHour, tickMinute, tickSecond, AskVolume, BidVolume, Volume);
sc.AddMessageToLog(DebugMessage, 0);
}
I compared the output of this with the built-in "Numbers Bars Calculated Values" study but my study shows much higher of every kind of volume than the built-in solution.

The question is, what have I mistaken? How those ask/bid volumes are calculated?

Thanks, Balazs
[2025-11-09 19:57:48]
User358514 - Posts: 14
I would like to revive this thread with a very similar question.
I need to calculate the maxDelta(Maximum Ask Volume Bid Volume Difference SG8) and minDelta(Minimum Ask Volume Bid Volume Difference SG9) values.
For this, it is crucial to have the same ordering of ticks as they come from the market, so the "sc.VolumeAtPriceForBars" function isn't an option due it isn't ordered.

Do you know how the above mentioned values being calculated in the "Numbers Bars Calculated Values" study?
What is the correct method for this?

Can I iterate over the ticks(with volumes) of a given bar somehow?

Thanks, Balazs
[2025-11-09 20:10:47]
Sierra_Chart Engineering - Posts: 21378
This really only can be done by Sierra Chart itself, when building chart bars and the arrays of this data are already available:
ACSIL Interface Members - Variables and Arrays: sc.BaseDataIn[][] / sc.BaseData[][]


sc.BaseData[SC_ASKBID_DIFF_HIGH]: The array containing the maximum difference between the Ask volume and the Bid volume for the bar at the specified Index. This is calculated at every tick during the creation of the bar.
For the data in this array to be most accurate, the Intraday Data Storage Time Unit setting in Global Settings >> Data/Trade Service Settings needs to be 1 Tick. The data in this array will not be available for historical data that does not have Ask Volume and Bid Volume.
For the chart to maintain the data in this array, you need to set sc.MaintainAdditionalChartDataArrays to TRUE in the sc.SetDefaults code block in your study function.
sc.BaseData[SC_ASKBID_DIFF_LOW]: The array containing the minimum difference between the Ask volume and the Bid volume for the bar at the specified Index. This is calculated at every tick during the creation of the bar. For the data in this array to be most accurate, the Intraday Data Storage Time Unit setting in Global Settings >> Data/Trade Service Settings needs to be 1 Tick. The data in this array will not be available for historical data that does not have Ask volume and Bid Volume.
For the chart to maintain the data in this array, you need to set sc.MaintainAdditionalChartDataArrays to TRUE in the sc.SetDefaults code block in your study function.

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2025-11-09 20:11:01

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

Login

Login Page - Create Account