# Agent G Integration Brief — EA + Indicator

You are the integrator. All 12 modules are merged on master at /mnt/agents/output/project.

## Mission
Write `Experts/Apex_NAS100_EA.mq5` and `Indicators/Apex_NAS100_Indicator.mq5` per SPEC.md sections 6–7.

## EA wiring (exact flow)
```mql5
// inputs mirror every CApexConfig field (Inp* names as in Presets/*.set)
// LoadConfig(CApexConfig &cfg) copies inputs → cfg
OnInit:
  cfg.Defaults(); LoadConfig(cfg);
  cfg.ResolveSymbol(sym);                    // sym global string
  df.Init(sym,cfg.AnalysisTF,cfg); mf.Init(...); vp.Init(...); vw.Init(...); ms.Init(...);
  amd.Init(sym,cfg.AnalysisTF,cfg,&df,&ms);
  if(cfg.UseOrderBook) ob.Init(sym);
  rg.Init(sym,cfg.AnalysisTF,cfg);
  eng.Init(cfg); eng.Bind(&df,&mf,&vp,&vw,&ms,&amd,&ob,&rg);
  risk.Init(sym,cfg); exec.Init(sym,cfg); relay.Init(cfg);
OnTick:
  ob.Update(); df.Update(); rg.Update(); risk.Update();
  if(risk.Halted()) { exec.CloseAll(risk.HaltReason()); return; }
  exec.Manage(rg.ATR());
  if(NewM5Bar()) {                           // compare iTime(sym,cfg.AnalysisTF,0)
     mf.Update(); vp.Update(); vw.Update(); ms.Update(); amd.Update();
     SSignal sig=eng.Evaluate();
     if(sig.valid && (cfg.Mode!=MODE_SIGNALS)) {
        string why;
        if(rg.TradingAllowedNow() && risk.CanOpen(why))
           exec.Execute(sig, risk.CalcLot(sig.entry,sig.sl));
     }
     if(sig.valid && (cfg.Mode!=MODE_AUTO)) relay.Emit(sig,sym);
  }
  Dashboard();                               // Comment() block, throttled to 250ms
OnBookEvent: ob.OnBookEvent();
OnTradeTransaction: if(trans.type==TRADE_TRANSACTION_DEAL_ADD && HistoryDealSelect(trans.deal)
                    && HistoryDealGetInteger(deal,DEAL_ENTRY)==DEAL_ENTRY_OUT
                    && HistoryDealGetInteger(deal,DEAL_MAGIC)==cfg.MagicNumber)
                    risk.NotifyClosedDeal(HistoryDealGetDouble(deal,DEAL_PROFIT));
                    // also risk.NotifyOpened() inside exec.Execute success path via EA
OnDeinit: risk.Persist(); if(cfg.UseOrderBook) ob.Deinit(); Comment("");
```

## Dashboard (Comment) fields
Mode | symbol+spread | session/regime/phase | score vs minScore | dailyDD%/max | overallDD%/max |
tradesToday/max | book imbalance+tape speed | quarterly bias | open P/L | last signal dir+setup+top 3 reasons |
HALT state.

## Indicator
Objects prefixed "AX_". OnCalculate: full recompute only on new M5 bar; draw D/W/M/Q VWAP as trend
lines across their anchor windows (+1σ daily bands), profile histogram on right margin via rectangles
(width ∝ NodeVol, POC=ClrPOC, VA bins=ClrVA), unmitigated OB/FVG rectangles (ms.GetOB/GetFVG),
EQH/EQL lines, D/W/M H-L lines, BUY/SELL arrows on fresh signals (own CSignalEngine instance, MODE
independent), dashboard panel via Comment. OnDeinit: ObjectsDeleteAll(0,"AX_").

## Rules
- #property strict, #property copyright/version. No trading in indicator.
- Follow SPEC §4 correctness rules; include guard not needed in .mq5.
- Commit each file separately on branch feat/main-app via worktree $HOME/work-feat-main-app.
