Login Page - Create Account

Support Board


Date/Time: Sat, 18 May 2024 09:53:50 +0000



[Programming Help] - SCDateTimeMS variables as persistent variables

View Count: 721

[2018-04-07 11:51:52]
User841591 - Posts: 42
I put SCDateTimeMS& LastAdjustmentDateTime = sc.GetPersistentDouble(1); in order store the time with millsecond in LastAdjustmentDateTime but I got the compiler error as below. Pls help to solve the problem.

SpreadTradeSys_V2.cpp: In function 'void scsf_SpreadTradeSys(SCStudyInterfaceRef)':
SpreadTradeSys_V2.cpp:173:63: error: invalid initialization of non-const reference of type 'SCDateTimeMS&' from an rvalue of type 'SCDateTimeMS'
SCDateTimeMS& LastAdjustmentDateTime = sc.GetPersistentDouble(1);
^
In file included from scstructures.h:79:0,
from sierrachart.h:15,
from SpreadTradeSys_V2.cpp:1:
scdatetime.h:1767:8: note: after user-defined conversion: SCDateTimeMS::SCDateTimeMS(double)
inline SCDateTimeMS::SCDateTimeMS(double DateTime)
[2018-04-12 01:27:30]
User841591 - Posts: 42
Any updates?
[2018-04-12 18:45:13]
Sierra Chart Engineering - Posts: 104368
The type SCDateTime also will hold milliseconds.

This is how you need to do it:
SCDateTimeMS& DateTimeMS = static_cast <SCDateTimeMS&>( sc.GetPersistentSCDateTime(1));

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
Date Time Of Last Edit: 2018-04-12 18:45:26

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

Login

Login Page - Create Account