Vizion-Trading-EA/AISession.mqh
49 lines
1.4 KiB
MQL5
#ifndef AI_SESSION_MQH
#define AI_SESSION_MQH
// ---------------------------------------------------------------------------
// AISession.mqh — Forex session detection + chart corner label
// Asia: 22:00-06:00 UTC | London: 07:00-12:00 UTC | NY: 13:00-17:00 UTC
// AMD: Accumulation | Manipulation | Distribution
// ---------------------------------------------------------------------------
string GetCurrentSession()
{
datetime now = TimeCurrent();
MqlDateTime dt;
TimeToStruct(now, dt);
int h = dt.hour;
if(h >= 22 || h < 6) return "Asia";
if(h >= 7 && h < 12) return "London";
if(h >= 13 && h < 17) return "NY";
return "Interbank";
}
void InitAISession()
{
GW_Session_Name = GetCurrentSession();
GW_Session_Phase = "Unknown";
GW_Session_Confidence = 0.0;
}
// The bottom-left session and news labels duplicated what the status panel
// already shows (session, phase, confidence, gateway status, headline), so
// they were removed — the panel is the single source of truth. This is kept
// as a no-op that clears anything an older build left on the chart.
void UpdateSessionLabel()
{
static bool cleared = false;
if(cleared) return;
ObjectDelete(0, "GW_SESSION_LABEL");
ObjectDelete(0, "GW_NEWS_LABEL");
cleared = true;
}
void CleanupSessionLabel()
{
ObjectDelete(0, "GW_SESSION_LABEL");
ObjectDelete(0, "GW_NEWS_LABEL");
}
#endif