Files
Bell-PriceActionWithEma-EA/Experts/EA_ICT_CL/Guards.mqh
T

28 lines
1.0 KiB
Plaintext
Raw Normal View History

2026-03-10 13:47:42 +07:00
#ifndef EA_ICT_CL__GUARDS_MQH
2026-03-10 20:39:33 +07:00
#define EA_ICT_CL__GUARDS_MQH
2026-03-10 13:47:42 +07:00
2026-03-10 21:17:12 +07:00
/** True if current time (UTC) is within London or NY session (InpLondon* / InpNY*). */
inline bool IsSessionAllowed()
{
2026-03-10 23:43:41 +07:00
return true;
2026-03-10 21:17:12 +07:00
int hourUtc = GetUTCHour(TimeCurrent());
return IsHourInRange(hourUtc, InpLondonStartHour, InpLondonEndHour)
|| IsHourInRange(hourUtc, InpNYStartHour, InpNYEndHour);
}
2026-03-10 20:39:33 +07:00
/** True if daily loss limit has not been hit. */
2026-03-10 22:21:59 +07:00
inline bool IsDailyLossOK() { return !g_DailyRisk.limitHit; }
/** True if middle TF has a clear trend (UP or DOWN). */
inline bool IsMiddleTrendValid() { return g_MiddleTrend.trend != DIR_NONE; }
2026-03-10 13:47:42 +07:00
2026-03-10 20:39:33 +07:00
/** Evaluates all guards; sets g_BlockReason and returns false if any guard fails. */
2026-03-10 13:47:42 +07:00
inline bool EvaluateGuards()
{
g_BlockReason = BLOCK_NONE;
2026-03-10 22:21:59 +07:00
if (!IsSessionAllowed()) { g_BlockReason = BLOCK_SESSION; return false; }
if (!IsDailyLossOK()) { g_BlockReason = BLOCK_DAILY_LOSS; return false; }
if (!IsMiddleTrendValid()) { g_BlockReason = BLOCK_NO_TREND; return false; }
2026-03-10 20:39:33 +07:00
return true;
2026-03-10 13:47:42 +07:00
}
2026-03-10 20:39:33 +07:00
#endif