Login Page - Create Account

Support Board


Date/Time: Sat, 27 Apr 2024 18:43:05 +0000



displaying milliseconds sc.CurrentSystemDateTimeMS

View Count: 1498

[2016-09-10 04:38:06]
User553714 - Posts: 184
Hi,

Can you please provide some information on sc.CurrentSystemDateTimeMS as I can't seem to find anything in the documentation which includes information on the Millisecond component of the time vale; everything seems to relate to HMS Minutes, Hours, seconds only without information on how to get the Milliseconds component which I think is the purpose of the sc.CurrentSystemDateTimeMS SC function? I have looked here http://www.sierrachart.com/index.php?page=doc/SCDateTime.html, searched for it's use in the ACS folder and also searched the support board but couldn't find anything.

I can get the HMS component easy enough, but not the millisecond component;
  // Get the hour, minute, second for the time
  DateTime = sc.CurrentSystemDateTimeMS;
  LastSystemTime = TIME_PART(DateTime);
  TIME_TO_HMS(LastSystemTime, Hour, Minute, Second);
  Time = HMS_TIME(Hour, Minute, Second);  //System Time in SECONDS from the LastSystemTime - Uses Variables Hour & Minute to calc
  TIME_TO_HMS(Time, Hour, Minute, Second);
  MessageString.Format("Hour: %d, Minute: %d, Second: %d", Hour, Minute, Second);
  sc.AddMessageToLog(MessageString, 1);


I am trying to display time as 14:24:14.656 so I can include a millisecond delay of my choosing using a while loop.

Any pointers will be appreciated
[2016-09-12 04:25:14]
Sierra Chart Engineering - Posts: 104368
The documentation requires additional updates.

However, refer to this section for now:
ACSIL Programming Concepts: Accessing Milliseconds
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
[2016-09-15 16:48:34]
Sierra Chart Engineering - Posts: 104368
Refer to this documentation here:
http://www.sierrachart.com/index.php?page=doc/SCDateTime.html#SCDateTimeMillisecondVariables
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
[2018-11-04 19:05:38]
Yoda - Posts: 106
After reading the above documentation, I too am struggling with how to access milliseconds. I'm wondering if perhaps the milliseconds documentation could be further expanded?

For example, in the input details of my study the following is currently working:

SessionStart.SetTime(HMS_TIME(8, 30, 0));

However, I would like to add a millisecond component, but nothing I've tried works, including

SessionStart.SetTime(HMS_TIME(8, 30, 0, 0));

SessionStart.SetTimeHMS_MS(HMS_TIME(8, 30, 0, 0));

SessionStart.SetTimeHMS_MS(8, 30, 0, 0);

SessionStart.SetTimeHMS_MS(HMS_MS_TIME(8, 30, 0, 0));

Also, in the SetTime() documentation Working with the SCDateTime Variables and Values: SetTime() it shows:

int TimeValue = HMS_TIME(16, 10, 0);

SCDateTimeVariable.SetTime(TimeValue);

But later in the SetTimeHMS_MS() section Working with the SCDateTime Variables and Values: SetTimeHMS_MS() it only shows:


SCDateTimeVariable.SetTimeHMS_MS(16, 10, 0, 0);

If possible, it would be great if the documentation was expanded to also show how we can define a variable with milliseconds. Like:


int TimeValueMS = HMS_MS_TIME(8, 30, 0, 0) // Does not work

SCDateTimeVariable.SetTimeHMS_MS(TimeValueMS);

Any help would be greatly appreciated.
[2018-11-05 17:34:35]
Yoda - Posts: 106
Is there anybody able to help me out with the above post?
[2018-11-05 18:41:48]
Yoda - Posts: 106
Considering no one is answering my questions in post # 4 above, I'm wondering if maybe there isn't a way to access milliseconds in ASCIL.

@Sierra Support - If this is not possible, please advise so I don't continue trying to make something work that is not possible. If it is possible, please advise how I can do this in the input details section and also by assigning it to a variable (as explained above in post #4)
[2018-11-05 21:06:37]
Sierra Chart Engineering - Posts: 104368
One thing we see is that you are just setting the milliseconds to 0. So effectively there are no milliseconds.
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
[2018-11-05 21:49:41]
Yoda - Posts: 106
Thank you for the reply. And you are correct, milliseconds was set to zero because I am trying to get the event to trigger exactly at 8:30:0:0

Based on your comment, I tried changing the code to the following:
SessionStart.SetTimeHMS_MS(8, 30, 0, 1);

And receive the following error when I compile the study:

CSV-SC-v01c-20181104-1540.cpp: In function 'void scsf_AccumulateVolume(SCStudyInterfaceRef)':
CSV-SC-v01c-20181104-1540.cpp:117:16: error: 'struct s_SCInput_145' has no member named 'SetTimeHMS_MS'
SessionStart.SetTimeHMS_MS(8, 30, 0, 1);

So what should be the member name...

SetTimeHMS_MS or SetTime(HMS_MS_TIME( or something else?

Same with this line...

int TimeValueMS = HMS_MS_TIME(8, 30, 0, 1)

What should HMS_MS_TIME be?
[2018-11-07 02:33:02]
Sierra Chart Engineering - Posts: 104368
One thing that was not clear to us is that you are you trying to use functions on a sc.Input structure. And we do not even know what the compiler result of that even is. So all of this is very vague from our perspective. Apparently SessionStart is a sc.Input.

To do what you want requires this function which will be added to the next release:
ACSIL Interface Members - sc.Input Array: sc.Input[].SetTimeAsSCDateTime()
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-11-07 02:33:38

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

Login

Login Page - Create Account