Comments chi tiết

This commit is contained in:
Bell
2026-03-10 19:28:06 +07:00
parent 1ddb802480
commit 3170da62ba
17 changed files with 380 additions and 422 deletions
+8 -11
View File
@@ -1,24 +1,21 @@
#ifndef EA_ICT_CL__SESSIONS_MQH
#define EA_ICT_CL__SESSIONS_MQH
#define EA_ICT_CL__SESSIONS_MQH // Tránh include trùng
// Module: Sessions
// Time/session filters live here (UTC-based if your EA uses UTC inputs).
// Module: Sessions kiểm tra giờ trong khoảng (UTC), dùng cho London/NY
inline bool IsHourInRange(const int hour, const int start_hour, const int end_hour)
{
// Handles normal and overnight windows:
// - start < end: [start, end)
// - start > end: [start, 24) U [0, end)
if (start_hour == end_hour) return true;
if (start_hour < end_hour) return (hour >= start_hour && hour < end_hour);
return (hour >= start_hour || hour < end_hour);
// start < end: [start, end); start > end: qua đêm [start,24) U [0,end)
if (start_hour == end_hour) return true; // Cả ngày
if (start_hour < end_hour) return (hour >= start_hour && hour < end_hour); // Cùng ngày
return (hour >= start_hour || hour < end_hour); // Qua nửa đêm
}
inline int GetUTCHour(const datetime t)
{
MqlDateTime dt;
TimeToStruct(t, dt);
return dt.hour;
TimeToStruct(t, dt); // Chuyển datetime sang struct (năm, tháng, giờ...)
return dt.hour; // Trả về giờ (023)
}
#endif // EA_ICT_CL__SESSIONS_MQH