Support Board
Date/Time: Thu, 27 Feb 2025 00:09:17 +0000
[Programming Help] - Iterating through past Time and Sales
View Count: 692
[2021-04-28 16:29:10] |
User5044343 - Posts: 68 |
I use the below loop to flag certain time and sales transactions and draw them on a 5 second chart. Issue is it only loops through "live" data - meaning from the time the study is added, doesn't draw anything on the chart prior to that. I also feel its not very efficient - study shows it takes about 2400 ms. Whats the best way to approach this? int64_t& LastProcessedSequence = sc.GetPersistentInt64(1); //reset the sequence number on a full recalculation so we start fresh for each full recalculation. if (sc.IsFullRecalculation && sc.Index == 0) LastProcessedSequence = 0; // Get the Time and Sales c_SCTimeAndSalesArray TimeSales; sc.GetTimeAndSales(TimeSales); if (TimeSales.Size() == 0) return; // No Time and Sales data available for the symbol //Set the initial sequence number if (LastProcessedSequence == 0) { LastProcessedSequence = TimeSales[TimeSales.Size() - 1].Sequence; return; } const int threshold = Threshold.GetInt(); // Loop through the Time and Sales. for (int TSIndex = 0; TSIndex < TimeSales.Size(); ++TSIndex) { s_TimeAndSales Record = TimeSales[TSIndex]; Record *= sc.RealTimePriceMultiplier; //do not reprocess previously processed sequence numbers. if (Record.Sequence <= LastProcessedSequence) continue; LastProcessedSequence = Record.Sequence; |
[2021-06-13 09:52:47] |
User411647 - Posts: 21 |
Hey mate can you please explain to me what exactly this code means? |
To post a message in this thread, you need to log in with your Sierra Chart account: