Login Page - Create Account

Support Board


Date/Time: Wed, 24 Apr 2024 23:21:05 +0000



Help: Time within Bar

View Count: 813

[2019-03-14 22:18:15]
rahul - Posts: 160
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: 104368
It is best to look at the ending time and do the calculation by using this array:
ACSIL Interface Members - Variables and Arrays: sc.BaseDataEndDateTime[]
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
[2019-03-15 14:14:37]
rahul - Posts: 160
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: 104368
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. 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

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

Login

Login Page - Create Account