Support Board
Date/Time: Tue, 01 Jul 2025 01:38:01 +0000
[Programming Help] - Time and sales data using using c++ custom programming
View Count: 127
[2025-06-20 13:10:01] |
User335827 - Posts: 1 |
Hi Sierra I am trying to write some signal processing code on the time and sales data using your custom interface. I have a problem when I compare your time and sales window to the data I receive within a study. I use dat = GetDateTimeOfLastTradeRecord() to compare with the previous study loop iteration to make sure there is new data. I then use the GetIndexOfLessEqualRecordAtDateTime(oldDat); for the new starting position and cycle round until up to date. I filter on record type with TimeAndSalesRecord.Type == SC_TS_BID || TimeAndSalesRecord.Type == SC_TS_ASK to screen out any type 6 data but I get reduced number of trades reported both in quantity and volume. I am a coder of 30 years c++ and c#, and I am using vs2022 >> debug >> attach to single step the process, but still no joy where the problem is. I will include a code snip, just in case... // Get DOM data s_MarketDepthEntry DepthEntry; std::string dom_data; c_SCTimeAndSalesArray TSArray; sc.GetTimeAndSales(TSArray); SCDateTimeMS dat = TSArray.GetDateTimeOfLastTradeRecord(); int lastNum = TSArray.GetSequenceNumberOfLastElement(); // THIS SHOULD BE THE POINTER TO WORK OUT THE ONES MISSED // Loop through the Time and Sales if (dat != oldDat) { // Add the namespace or class scope to correctly reference the method int ptrOfLast = TSArray.GetIndexOfLessEqualRecordAtDateTime(oldDat); int TSIndex = TSArray.Size() - 1; s_TimeAndSales TimeAndSalesRecord = TSArray[TSIndex]; int yr = 0; int mn = 0; int dy = 0; int hr = 0; int min = 0; int sec = 0; int mill = 0; int bidSize = 0; int askSize = 0; if (ptrOfLast != TSIndex) { do { ptrOfLast += 1; // Increment oldDat to avoid reprocessing std::string side; TimeAndSalesRecord = TSArray[ptrOfLast]; if (TimeAndSalesRecord.Type == SC_TS_BID || TimeAndSalesRecord.Type == SC_TS_ASK) { if (TimeAndSalesRecord.Type == SC_TS_BID) side = "C"; if (TimeAndSalesRecord.Type == SC_TS_ASK) side = "D"; TimeAndSalesRecord.DateTime.GetDateTimeYMDHMS_MS(yr, mn, dy, hr, min, sec, mill); std::stringstream ss; ss << side << TimeAndSalesRecord.Price << ", " << TimeAndSalesRecord.Volume << ", " << std::setw(2) << std::setfill('0') << hr << ":" << std::setw(2) << std::setfill('0') << min << ":" << std::setw(2) << std::setfill('0') << sec << ":" << std::setw(3) << std::setfill('0') << mill << " " << "\r\n"; dom_data += ss.str(); } } while (ptrOfLast <= TSIndex); } oldDat = dat; } |
![]() Attachment Deleted. |
To post a message in this thread, you need to log in with your Sierra Chart account: