Login Page - Create Account

Support Board


Date/Time: Thu, 23 May 2019 22:08:36 +0000



Help: Time within Bar

Support Request:
[2019-03-14 22:18:15]
rahul - Posts: 70
Hello, I understand that sc.BaseDateTimeIn[sc.Index].GetTime() returns the beginning time of the bar. If I am trading 1 minute chart and want to exit by 55 seconds after start of bar, how do I know how much time has elapsed since start of bar?
[2019-03-15 04:33:34]
Sierra Chart Engineering - Posts: 72106
It is best to look at the ending time and do the calculation by using this array:
https://www.sierrachart.com/index.php?page=doc/ACSIL_Members_Variables_And_Arrays.html#scBaseDataEndDateTime
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.
[2019-03-15 14:14:37]
rahul - Posts: 70
So if a bar is not complete, will sc.BaseDataEndDateTime[] give me time latest time, if I set the data storage unit to 1 second? Will this even work in backtesting?
In that case, will this work?

Time Elapsed = sc.BaseDataEndDateTime[sc.Index].GetTime() - sc.BaseDateTimeIn[sc.Index].GetTime();

The problem is I have multiple contract order fills at the close of a bar... to avoid a lot of slippage I want to close the trades at 5 second intervals prior to bar close
Suppose I have 3 contracts and its a 1 minute bar.
If Bar Open = 9:30am and next Bar Open = 9:31am, I want trades to occur at 9:30:50, 9:30:55 and 9:31am respectively
[2019-03-15 17:15:56]
Sierra Chart Engineering - Posts: 72106
So if a bar is not complete, will sc.BaseDataEndDateTime[] give me time latest time, if I set the data storage unit to 1 second? Will this even work in backtesting?
Yes, yes.

You are able to do what you want.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. If possible please keep your questions brief and to the point. Please be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

If your question/request has been answered and you do not have anything further, then it is easiest for us if you do not reply again to say thank you.

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

Login


Login Page - Create Account