Login Page - Create Account

Support Board


Date/Time: Tue, 07 Apr 2026 22:04:15 +0000



GetTimeAndSales & ReadIntradayFileRecordAtIndex discrepancy

View Count: 259

[2026-02-17 21:09:39]
Asad1939 - Posts: 17
Hi

From the docs: To access individual trades and bid/ask updates in between calls into the study function, use the following functions:

sc.GetTimeAndSales
sc.ReadIntradayFileRecordAtIndex

I am wondering why data from these two functions is different.

My understanding is that sc.ReadIntradayFileRecordAtIndex returns all trades that occurred within the start and end time of a bar.

Theoretically we should be able to get these trades from GetTimeAndSales by filtering s_TimeAndSales::Type on SC_TS_BID and SC_TS_ASK and the timestamp on the start and end time of a bar.

The problem is, I obtain two very different results. There are many more trades reported from GetTimeAndSales (almost double in some cases) than ReadIntradayFileRecordAtIndex.

Can you confirm for me my understanding of these two functions is correct, that is they should return the same trade list?

Or is there other filters that need to be applied to GetTimeAndSales so that it matches the result from ReadIntradayFileRecordAtIndex (aside from the 3 mentioned)

Thanks
Date Time Of Last Edit: 2026-02-17 21:12:05
[2026-02-17 22:37:21]
Sierra_Chart Engineering - Posts: 23450
Before we begin to answer this, what is this setting set to?:
Data/Trade Service Settings: Intraday Data Storage Time Unit (Global Settings >> Data/Trade Service Settings >> Common Settings >> Common Settings)
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: 2026-02-17 22:38:02
[2026-02-18 00:26:44]
Asad1939 - Posts: 17
Intraday Data Storage Time Unit is set to 1 Tick
[2026-02-18 18:47:04]
Sierra_Chart Engineering - Posts: 23450
This function is only going to read a single record, 1 Tick/Trade, at a time:
sc.ReadIntradayFileRecordAtIndex

You really need to use this function:
ACSIL Interface Members - Functions: sc.ReadIntradayFileRecordForBarIndexAndSubIndex()

And you need to call it multiple times to read all of the records in order to get all of the trades per bar.
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: 2026-02-18 18:47:33
[2026-02-18 19:07:45]
Asad1939 - Posts: 17
Apologies. I'm already using this function - I should have wrote ReadIntradayFileRecordForBarIndexAndSubIndex not ReadIntradayFileRecordAtIndex in my original post.

For each bar, I call ReadIntradayFileRecordForBarIndexAndSubIndex, and loop sub_index with while (true) until read_ok == 0. That gives me all available ticks for the bar.

But this is nowhere near the number reported by GetTimeAndSales (with the 3 filters applied in my orginal post). Any ideas why that might be?

I'd like to know exactly what GetTimeAndSales is returning, or if there's additional filters needed to get the same output as ReadIntradayFileRecordForBarIndexAndSubIndex

Thanks
[2026-02-19 01:04:49]
seandunaway - Posts: 379
it's been a while but if i recall correctly i think you need to consider the sequence number when getting time and sales data or else you'll be revisiting the same records
Date Time Of Last Edit: 2026-02-19 01:11:32
[2026-02-19 05:06:35]
Sierra_Chart Engineering - Posts: 23450
Regarding post #5 there could not be any problem with this because there is this example study provided with Sierra Chart which proves the function is working properly:
scsf_ReadChartBarRecordsFromUnderlyingIntradayFileExample

Refer to:
How to Build an Advanced Custom Study from Source Code: Searching for Source Code for Sierra Chart Built-In Studies

We recommend using the Intraday data editor to examine all of the records for a particular chart bar:
Intraday Data Editor

And then you can compare those records to the Time and Sales data you see in the Time and Sales window:
Time and Sales Window
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: 2026-02-19 05:08:46
[2026-02-19 16:01:53]
Asad1939 - Posts: 17
Apologies maybe I am not being clear.

I don't think there is anything wrong with either function. I am just asking about their usage.

I use the recommend examples to get all the ticks/trades from ReadIntradayFileRecordForBarIndexAndSubIndex for a given bar.

While the Bar is forming I collect all ticks with GetTimeAndSales - filtering for SC_TS_BID and SC_TS_ASK and the timestamp on the start and end time of a bar, and processing the sequence number as in the Studies5.cpp example.

The problem is the two sets of trade lists I get is very different. I trust both are correct, but my understanding is lacking and I couldn't find anything in the help documents to clarify. I completely understand the trades returned by ReadIntradayFileRecordForBarIndexAndSubIndex (I'm using denali and I've cross referenced the trades with another feed). But I don't get why GetTimeAndSales is returning so many extra trades after I've applied the filter from the docs. Could you help clarify please?

I can provide an example if needed.
Date Time Of Last Edit: 2026-02-19 16:03:10
[2026-02-19 16:11:48]
Sierra_Chart Engineering - Posts: 23450
This is outside the scope of our support. It requires very in-depth analysis of the data and what you are doing.

Also they both could not be correct.
I trust both are correct,

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: 2026-02-19 16:12:27
[2026-02-19 20:09:59]
Asad1939 - Posts: 17
Ok sure, no problem. Can you atleast confirm my understanding is correct and in theory both functions should be giving the same output once filtered for SC_TS_BID and SC_TS_ASK?
[2026-02-19 22:45:18]
Sierra_Chart Engineering - Posts: 23450
Yes:
Can you at least confirm my understanding is correct and in theory both functions should be giving the same output once filtered for SC_TS_BID and SC_TS_ASK?

You should see the same number of records between Time and Sales and the Intraday data file for a period of time like one minute corresponding to a chart bar in the case of when using 1 minute chart bars. There is no reason for them to be any different.

This is why we said, to use the Intraday data editor, and compare what you see in the Intraday file compared to the Time and Sales window.
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: 2026-02-19 22:45:27

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

Login

Login Page - Create Account