Vizion-Trading-EA/VZ_SessionsDefs.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 VZ_SESSIONS_DEFS_MQH
#define VZ_SESSIONS_DEFS_MQH
//+------------------------------------------------------------------+
//| VZ_SessionsDefs.mqh |
//| Shared contract between VZ_Sessions.mq5 and any consumer of it. |
//| Both sides include this file so buffer indices cannot drift. |
//| Changing a buffer number here is a breaking change — rebuild |
//| the indicator AND every EA that reads it. |
//+------------------------------------------------------------------+
// Value carried by the SESSION_ID buffer.
// Windows are configurable, but OVERLAP always means "London and New York
// are both open" and takes precedence over either single-session label.
enum ENUM_VZ_SESSION
{
VZ_SESS_OFF = 0, // between sessions (post-NY, pre-Asia)
VZ_SESS_ASIA = 1,
VZ_SESS_LONDON = 2, // London open, NY not yet
VZ_SESS_OVERLAP = 3, // London + NY both open
VZ_SESS_NY = 4 // NY open, London closed
};
// Value carried by the AMD_PHASE / AMD_PHASE_RETRO buffers.
enum ENUM_VZ_AMD_PHASE
{
VZ_AMD_NONE = 0, // outside a tracked cycle
VZ_AMD_ACCUMULATION = 1, // Asia window open, range building
VZ_AMD_PENDING = 2, // Asia closed, waiting for a sweep
VZ_AMD_MANIPULATION = 3, // sweep reclaimed — AMD_BIAS is live from here
VZ_AMD_DISTRIBUTION = 4, // displacement confirmed in the bias direction
VZ_AMD_EXPANSION = 5, // broke the range and never reclaimed: trend day
VZ_AMD_NO_SETUP = 6, // Asia range too wide to count as accumulation
VZ_AMD_INVALIDATED = 7 // closed back beyond the sweep extreme
};
// Buffer indices for CopyBuffer(handle, <index>, ...).
#define VZ_BUF_SESSION_ID 0 // ENUM_VZ_SESSION as a double
#define VZ_BUF_ASIA_HIGH 1 // running while Asia is open, frozen after
#define VZ_BUF_ASIA_LOW 2
#define VZ_BUF_SESSION_HIGH 3 // running extreme of the current session
#define VZ_BUF_SESSION_LOW 4
#define VZ_BUF_PREV_DAY_HIGH 5
#define VZ_BUF_PREV_DAY_LOW 6
#define VZ_BUF_PREV_DAY_CLOSE 7
#define VZ_BUF_LONDON_OPEN 8 // EMPTY_VALUE until the open has happened
#define VZ_BUF_NY_OPEN 9
#define VZ_BUF_ASIA_RANGE_ATR 10 // Asia range / ATR(D1); EMPTY until Asia closes
// ── AMD ─────────────────────────────────────────────────────────────────────
// AMD_PHASE is what was knowable AT that bar. It is written once and never
// revised. AMD_PHASE_RETRO is the hindsight labelling and IS revised as
// evidence arrives — the manipulation leg gets back-filled onto bars that,
// at the time, looked like nothing.
//
// CONSUMERS MUST READ ONLY AMD_PHASE. Reading AMD_PHASE_RETRO from an EA or
// into an NN feature vector leaks the future into the past and will produce
// backtests that cannot be reproduced live. RETRO exists for chart review.
#define VZ_BUF_AMD_PHASE 11 // ENUM_VZ_AMD_PHASE — non-repainting
#define VZ_BUF_AMD_PHASE_RETRO 12 // ENUM_VZ_AMD_PHASE — REPAINTS BY DESIGN
#define VZ_BUF_AMD_BIAS 13 // -1 / 0 / +1 expected distribution direction
#define VZ_BUF_AMD_CONFIDENCE 14 // 0..100, valid once phase >= MANIPULATION
#define VZ_BUF_AMD_SWEEP_LEVEL 15 // the Asia boundary that was swept
#define VZ_BUF_AMD_INVALIDATION 16 // sweep extreme; a close beyond it kills the read
#define VZ_BUF_AMD_MARK_CONF 17 // arrow at the bar manipulation was CONFIRMED
#define VZ_BUF_AMD_MARK_RETRO 18 // arrow at the sweep extreme bar (hindsight)
#define VZ_BUF_COUNT 19
// Daylight-saving rule applied on top of the broker's base GMT offset.
enum ENUM_VZ_DST
{
VZ_DST_NONE = 0, // broker offset is fixed year-round
VZ_DST_EU = 1, // last Sun Mar 01:00 UTC .. last Sun Oct 01:00 UTC
VZ_DST_US = 2 // 2nd Sun Mar 07:00 UTC .. 1st Sun Nov 06:00 UTC
};
#endif