Login Page - Create Account

Support Board


Date/Time: Mon, 13 May 2024 10:13:45 +0000



ACSIL - The indexing of the TimeAndSales array

View Count: 992

[2017-01-25 20:59:58]
Zosimus - Posts: 345
When I loop through all the elements of the TimeAndSales array, can I assume that each element of the array represents a different trade and that the order of the elements in the array represent the order in which the trades took place?

When I print all the array elements to the Message Log I see trade volumes that do not seem to match what I see in the Time and Sales window. Also I see many consecutive array elements with the same volume. Of course we do often get consecutive trades with the the same volumes but in the TimeAndSales array there seem to be much to many repetitions.

The Log with the printed array entries is attached.
This is the code I used to get the TimeAndSales array volume values.

SCTimeAndSalesArray TimeSales;
sc.GetTimeAndSales(TimeSales);
if (TimeSales.Size() == 0) return;
    
for (int TSIndex = 0 ; TSIndex < TimeSales.Size(); ++TSIndex){
SCString str;  
str.Format("TSIndex = %i ----- TnS Entry Volume = %i",TSIndex, TimeSales[TSIndex].Volume);
sc.AddMessageToLog(str, 0);
}
Attachment Deleted.
attachmentTnS_Array_Entries.txt - Attached On 2017-01-25 20:52:07 UTC - Size: 590.12 KB - 280 views
[2017-01-26 05:06:02]
Sierra Chart Engineering - Posts: 104368
When I loop through all the elements of the TimeAndSales array, can I assume that each element of the array represents a different trade and that the order of the elements in the array represent the order in which the trades took place?
No and Yes. The information below makes this more clear.

This has been added to the documentation:
When iterating through the Time and Sales data, to only process those records which are trades, you need to compare the s_TimeAndSales::Type member to SC_TS_BID and SC_TS_ASK and only process records with these types.

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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account