Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 01:38:37 +0000



Post From: How to compare sc.BaseDateTimeIn[sc.Index].GetTime() with s_ChartSessionTimes.StartTime

[2023-06-20 20:18:42]
emmanuel - Posts: 58
I'm having difficulty comparing the "bar time" with the chart session times in order to have my trading system only trade within the session time:


n_ACSIL::s_ChartSessionTimes SessionTimes;
sc.GetSessionTimesFromChart(sc.ChartNumber, SessionTimes);
int BarTime = sc.BaseDateTimeIn[sc.Index].GetTime();

SCString FormattedMessage;
sc.AddMessageToLog(FormattedMessage.Format("BarTime %i, StartTime %i, EndTime %i", BarTime, SessionTimes.StartTime, SessionTimes.EndTime), 0);

if(BarTime < SessionTimes.StartTime || BarTime >= SessionTimes.EndTime) return;

In the message log I see entries such as...

Chart: ESM23-CME[M] 1 Min #1 | Study: ***: BarTime 30540, StartTime 1156760, EndTime 1156848 | 2023-06-20 19:46:53.560

So it looks like the time representation between
sc.BaseDateTimeIn[sc.Index].GetTime()
and
s_ChartSessionTimes.StartTime
is different, though they are the same data type. How can I compare these values?