Support Board
Date/Time: Fri, 27 Dec 2024 02:29:59 +0000
Post From: Live data versus replay data problem
[2016-02-18 04:50:15] |
Sierra Chart Engineering - Posts: 104368 |
There was a small addition we had to make to the code and that is now done. So here is the proper code example for what you want. This has not been tested. SCSFExport scsf_TimeAndSalesIterationExample(SCStudyInterfaceRef sc)
{ if (sc.SetDefaults) { // Set the configuration and defaults sc.GraphName = "Time and Sales Iteration Example"; sc.StudyDescription = "This is an example of iterating through the time and sales records which have been added since the last study function call."; sc.AutoLoop = 1; sc.FreeDLL = 0; return; } //Only do this processing on the last bar if (sc.Index == sc.ArraySize-1) { __int64& LastProcessedSequence = sc.GetPersistentInt64 (1); // Get the Time and Sales SCTimeAndSalesArray TimeSales; sc.GetTimeAndSales(TimeSales); if (TimeSales.Size() == 0) return; // No Time and Sales data available for the symbol if (LastProcessedSequence != 0)//only iterate the time and sales if have a prior sequence number { // Loop through the Time and Sales. for (int TSIndex = 0; TSIndex < TimeSales.Size() ; ++TSIndex) { if(TimeSales[TSIndex].Sequence < LastProcessedSequence) continue; //only interested in trade records if (TimeSales[TSIndex].Type == SC_TS_BID || TimeSales[TSIndex].Type == SC_TS_ASK ) { float TradePrice = TimeSales[TSIndex].Price; float BidPrice = TimeSales[TSIndex].Bid; float AskPrice = TimeSales[TSIndex].Ask; } } } LastProcessedSequence = TimeSales[TimeSales.Size()-1 ].Sequence; } } 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 |