Login Page - Create Account

Support Board


Date/Time: Sat, 23 Nov 2024 21:38:41 +0000



[Programming Help] - Cannot Get End Time of the Intraday Chart

View Count: 146

[2024-07-30 05:23:50]
Vibhor - Posts: 2
I want to make a loop where if current time is greater than or equal to the end session time then it checks if there are open trades. After that it flatten and cancel all orders. I have used SCDateTime currentTime = sc.GetCurrentDateTime(); to get the current time but for end session time i am unable to find anything, If i use "SCDateTime endSessionTime = sc.BaseDataEndDateTime[sc.ArraySize - 1];" and if there is no bar at end time or incomplete bar then this is not working as intended. is there anything else I can use to get the end session time and compare them so I can flatten and cancel all orders??
Thank you in advance.
[2024-07-30 08:03:59]
User431178 - Posts: 541

sc.BaseDataEndDateTime[sc.ArraySize - 1]

That is not going to be of much help here, it is the bar end time, not the session (and only works if sc.scMaintainAdditionalChartDataArrays is set).
ACSIL Interface Members - Variables and Arrays: sc.MaintainAdditionalChartDataArrays


Instead you can access the chart session times directy and compare against the current time (or current bar time).

ACSIL Interface Members - Variables and Arrays: sc.EndTime1
ACSIL Interface Members - Variables and Arrays: sc.EndTime2

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

Login

Login Page - Create Account