Vizion-Trading-EA/AISession.mqh
SahrJohn SahrJohn 526860b9cd EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
  opening deal ("dir_src":"entry"); the closing deal inverted every direction and
  restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
  service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00
#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