Support Board
Date/Time: Tue, 25 Feb 2025 20:21:59 +0000
Post From: Looking for a way to get the next trading day start session time
[2021-04-22 21:30:41] |
User785302 - Posts: 8 |
Hello I am successfully using n_ACSIL::s_ChartSessionTimes to get the .StartTime which is the RTH time. e.g. usually 8:30 am CST. this works fine during realtime updating but during initial loading I can't affort it performance wise and hence am looking for way to "jump" directly to the next trading day.I discovered sc.GetTradingDayStartDateTimeOfBar but that takes me to the beginning of the evening session and when I add a day on Friday it takes me to Saturday, which is not a trading day. I tried this here PDT_NextUpdate = SCDateTime(sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[Index]).GetDate(), PDT_DailyUpdateTime.GetTimeInSeconds()) + SCDateTime::DAYS(1); // PDT_DailyUpdateTime is SCDateTime that stores my daily update time for a calculation. PDT_NextUpdate = SCDateTime(sc.GetTradingDayStartDateTimeOfBar(sc.BaseDateTimeIn[sc.GetNearestMatchForSCDateTime(sc.ChartNumber, SCDateTime(sc.BaseDateTimeIn[Index].GetDate(), PDT_SessionEndTime.GetTimeInSeconds() + 61))]).GetDate(), PDT_DailyUpdateTime.GetTimeInSeconds()) + SCDateTime::DAYS(1); // PDT_SessionEndTime is a SCDateTime that stores the RTH SessionEndTime (from n_ACSIL::s_ChartSessionTimes.EndTime. Hope you understand my problem. Ideally, I'd like a function sc.GetNextTradingDate(SCDateTime) that would return an SCDateWith the nextTradingDate. Basically, it's a function that adds 1 day but also takes into consideration weekends and perhaps public holidays where no trading takes place. |