Support Board
Date/Time: Wed, 27 Nov 2024 14:21:50 +0000
Can you add support for milliseconds for sc.GetContainingIndexForSCDateTime
View Count: 511
[2023-08-23 17:18:17] |
AlinGA - Posts: 14 |
Can you add support for milliseconds (SCDateTimeMS as input ) for sc.GetContainingIndexForSCDateTime ? On lower timeframes of volume/nr of trades charts the second resolution is not enough and have duplicate indexes for same SCDateTime. Thanks |
[2023-08-23 18:03:37] |
Sierra_Chart Engineering - Posts: 17193 |
This is already the case. This function supports precision to microseconds. Is there any documentation which says otherwise?
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 |
[2023-08-23 18:35:12] |
AlinGA - Posts: 14 |
if I input a SCDateTime variable works ok but the resolution is at 1 second as that is the limitations of SCDateTime , if I input a SCDateTimeMS variable give me an error.
|
[2023-08-23 23:39:28] |
Sierra_Chart Engineering - Posts: 17193 |
SCDateTime has precision to microseconds. SCDateTimeMS is the same as SCDateTime. They are identical and have been that way for years now. There is some out of date documentation regarding SCDateTimeMS/SCDateTime and comparisons, but we have now updated that. Comparisons are always to the microsecond for many years now. 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: 2023-08-24 01:27:19
|
[2023-08-24 02:32:13] |
AlinGA - Posts: 14 |
so, I have this example code ********************************************************************************************************/ #include "sierrachart.h" SCDLLName("Test9999") void WriteIntToLog (SCStudyInterfaceRef sc, const int integervalue, SCString Label) { SCString Messagetw; Messagetw.Format(" %s : %i", Label.GetChars(), integervalue); sc.AddMessageToLog(Messagetw, 1); } void WriteFloatToLog (SCStudyInterfaceRef sc, const float floatvalue, SCString Label) { SCString Messagetwf; Messagetwf.Format(" %s : %f", Label.GetChars(), floatvalue); sc.AddMessageToLog(Messagetwf, 1); } /****************************************************************************/ SCSFExport scsf_Test9999(SCStudyInterfaceRef sc) { if (sc.SetDefaults) { sc.GraphName = "Test9999"; sc.StudyDescription = "More info pls DM me at https://twitter.com/MnuchinB"; sc.AutoLoop = 1; sc.GraphRegion = 0; sc.ValueFormat = VALUEFORMAT_INHERITED; // sc.MaintainHistoricalMarketDepthData = 1; // sc.UsesMarketDepthData = 1; } // Data processing // WriteIntToLog(sc, i, ""); // WriteFloatToLog(sc, f, ""); // E.G. int CurrentBarDate = sc.BaseDateTimeIn[sc.Index].GetDate(); int CurrentBarTime = sc.BaseDateTimeIn[sc.Index].GetTimeInMilliseconds(); SCDateTime DateTime(CurrentBarDate ,CurrentBarTime ); int Index = sc.GetContainingIndexForSCDateTime(sc.ChartNumber, DateTime); WriteIntToLog(sc, Index, "Index"); } it should iterate thru the sc.Index from 0 to sc.ArraySize - 1 instead this is the log, all past indexes are all over the place, once it gets on live data works as it should Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 248910 | 2023-08-23 22:25:53.154 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 255248 | 2023-08-23 22:25:53.154 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | 2023-08-23 22:25:53.154 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 196422 | Number times prior message previously added: 10623 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 201342 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 226008 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 226608 | Number times prior message previously added: 2 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 237599 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 238685 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 239548 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 244626 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 248158 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 248800 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 248962 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 248987 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 249286 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 249419 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 249928 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 250515 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 259874 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | 2023-08-23 22:25:53.162 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 201205 | Number times prior message previously added: 11841 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 201820 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 212912 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 213512 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 214232 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 226008 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 226893 | Number times prior message previously added: 1 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 231422 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 237849 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 245607 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 249476 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 252560 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 259939 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | 2023-08-23 22:25:53.169 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 214335 | Number times prior message previously added: 12402 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 226008 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 226680 | Number times prior message previously added: 2 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 240114 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 245896 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 249399 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 259667 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 259677 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | 2023-08-23 22:25:53.177 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 235889 | Number times prior message previously added: 13039 | 2023-08-23 22:25:53.185 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 250780 | 2023-08-23 22:25:53.185 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | 2023-08-23 22:25:53.185 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | Number times message previously added: 33700 | 2023-08-23 22:26:02.774 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | Number times message previously added: 29 | 2023-08-23 22:26:12.316 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | Number times message previously added: 18 | 2023-08-23 22:26:22.474 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | Number times message previously added: 15 | 2023-08-23 22:26:32.138 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260210 | Number times message previously added: 21 | 2023-08-23 22:26:41.989 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260211 | 2023-08-23 22:26:42.208 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260211 | Number times message previously added: 22 | 2023-08-23 22:26:51.834 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260211 | Number times message previously added: 30 | 2023-08-23 22:27:01.783 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260211 | Number times message previously added: 20 | 2023-08-23 22:27:13.063 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260211 | Number times message previously added: 26 | 2023-08-23 22:27:22.692 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260212 | 2023-08-23 22:27:23.017 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260212 | Number times message previously added: 32 | 2023-08-23 22:27:32.563 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260212 | Number times message previously added: 21 | 2023-08-23 22:27:42.537 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260212 | Number times message previously added: 24 | 2023-08-23 22:27:52.172 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260212 | Number times message previously added: 27 | 2023-08-23 22:28:01.684 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times prior message previously added: 27 | 2023-08-23 22:28:10.894 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times message previously added: 28 | 2023-08-23 22:28:20.663 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times message previously added: 18 | 2023-08-23 22:28:30.184 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times message previously added: 37 | 2023-08-23 22:28:39.717 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times message previously added: 20 | 2023-08-23 22:28:49.336 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times message previously added: 22 | 2023-08-23 22:28:58.855 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260213 | Number times message previously added: 32 | 2023-08-23 22:29:08.493 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260214 | Number times prior message previously added: 9 | 2023-08-23 22:29:12.646 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260214 | Number times message previously added: 18 | 2023-08-23 22:29:22.202 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260214 | Number times message previously added: 21 | 2023-08-23 22:29:31.741 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260214 | Number times message previously added: 13 | 2023-08-23 22:29:41.263 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260214 | Number times message previously added: 15 | 2023-08-23 22:29:51.125 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260214 | Number times message previously added: 24 | 2023-08-23 22:30:00.864 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260215 | Number times prior message previously added: 3 | 2023-08-23 22:30:02.167 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260215 | Number times message previously added: 33 | 2023-08-23 22:30:11.715 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260215 | Number times message previously added: 26 | 2023-08-23 22:30:21.782 Chart: NQU23-CME[M] 50 Trades #1 | Study: Test9999 | Index : 260215 | Number times message previously added: 30 | 2023-08-23 22:30:31.749 |
[2023-08-24 03:45:46] |
Sierra_Chart Engineering - Posts: 17193 |
This is wrong: int CurrentBarDate = sc.BaseDateTimeIn[sc.Index].GetDate(); int CurrentBarTime = sc.BaseDateTimeIn[sc.Index].GetTimeInMilliseconds(); SCDateTime DateTime(CurrentBarDate ,CurrentBarTime ); It needs to be: SCDateTime DateTime=sc.BaseDateTimeIn[sc.Index] ; 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 |
[2023-08-24 04:09:01] |
AlinGA - Posts: 14 |
So the code above works as it should if I use GetTime() instead of GetTimeinMilliseconds() but I’m limited to the second resolution. Tried GetTimeAsDouble() same issue. Problem is this goes out of sierra and then gets imported back , how do I safely convert a SCDateTime variable to a combination of integers and back to a SCDateTime variable that will allow me to use the above function? |
[2023-08-24 04:13:26] |
Sierra_Chart Engineering - Posts: 17193 |
You are not using the right constructor. The constructor you are using takes the time as seconds only. We are not sure exactly what you want to do, but you should not be obtaining the Date-Time value as two separate integers. You can use these member functions to work with a single 64-bit integer: inline int64_t GetInternalDateTime() const
{ return m_dt; } inline void SetInternalDateTime(int64_t InternalDateTimeValue) { m_dt = InternalDateTimeValue; } 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: 2023-08-24 04:13:38
|
[2023-08-24 04:31:28] |
AlinGA - Posts: 14 |
Oh, so the constructer is limited to seconds. What I’m trying to do - is to export a subgraph to a file and then reload it on the chart for backtest purposes ( is based on market depth and pull/stack calculations and will need a replay and long time loading to rebuild). I’ll post the code tomorrow. |
[2023-08-24 15:34:17] |
Sierra_Chart Engineering - Posts: 17193 |
No, the constructor is not limited to seconds. You are using a constructor that takes the Time as seconds. There are multiple constructors. You are using the wrong one. We do not need to see the code unless you want to share it with others. 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 |
[2023-08-26 18:43:15] |
AlinGA - Posts: 14 |
I'll share it on my sierra charts discord anyway , this is the code , I put the fast CSV header too - source https://github.com/ben-strasser/fast-cpp-csv-parser ( please excuse my syntax - I'm a hobbyist not a programmer by trade)
Date Time Of Last Edit: 2023-08-26 18:45:42
|
SaveSubgraphsToFIle.cpp - Attached On 2023-08-26 18:41:12 UTC - Size: 15.72 KB - 538 views csv.h - Attached On 2023-08-26 18:41:26 UTC - Size: 35.77 KB - 489 views |
To post a message in this thread, you need to log in with your Sierra Chart account: