# Plan — NAS100 "Apex Scalper" MT5 EA + Indicator Suite

## Goal
Deliver a sophisticated, self-adjusting MQL5 scalping EA for NAS100 (US100/USTEC/NAS100 symbol aliases)
targeting high profitability with strict drawdown control, prop-firm compatible, dual-mode:
1) autonomous trade execution & management, 2) detailed signal relay (JSON files + push + chart dashboard)
for manual/copy trading on other accounts/platforms.

> Honesty note (to include in README): no system can guarantee 10%/month and <10% DD; we engineer
> toward that target with adaptive confluence scoring and institutional-grade risk controls.

## Hard constraints
- Pure MQL5 only. No ML, no Python, no DLLs, no paid dependencies.
- Level-2 via native MT5 `MarketBookGet` (free DOM when broker provides it, graceful degrade otherwise).
- Tick-volume delta approximation for buy/sell pressure (works on CFD feeds without real volume).

## Architecture (modular .mqh includes + main EA + companion indicator)
| Module | File | Responsibility |
|---|---|---|
| Config | `Apex_Config.mqh` | All inputs, symbol alias resolution, enums |
| DeltaFlow | `Apex_DeltaFlow.mqh` | Per-bar buy/sell pressure, cumulative delta, delta divergence |
| MoneyFlow | `Apex_MoneyFlow.mqh` | High-traded nodes, money-flow sentiment per bar, MFI-style pressure |
| VolumeProfile | `Apex_VolumeProfile.mqh` | Rolling profile, POC/VAH/VAL, HVN/LVN clusters |
| VWAP | `Apex_VWAP.mqh` | Daily/Weekly/Monthly/Quarterly anchored VWAP + sigma bands |
| MarketStructure | `Apex_MarketStructure.mqh` | Swing/internal structure, BOS/CHoCH, swing points, equal H/L, FVG, volumetric OBs (internal+swing), D/W/M highs-lows, premium/discount |
| AMD | `Apex_AMD.mqh` | Accumulation/Manipulation/Distribution phases via price×volume behavior |
| OrderBook | `Apex_OrderBook.mqh` | DOM imbalance, spread, tape proxy; degrade gracefully |
| Regime | `Apex_Regime.mqh` | Session, volatility regime, trend/range, momentum, reversal, liquidity state, market quarter |
| SignalEngine | `Apex_SignalEngine.mqh` | Weighted confluence scoring, entry/SL/TP synthesis, self-adjusting thresholds |
| RiskManager | `Apex_RiskManager.mqh` | Prop rules: daily DD, overall DD, consistency, sizing, time guards |
| TradeExecutor | `Apex_TradeExecutor.mqh` | Order placement/management, BE, trailing, partials |
| SignalRelay | `Apex_SignalRelay.mqh` | JSON/CSV signal files, push notifications, dashboard text feed |
| Main EA | `Apex_NAS100_EA.mq5` | Orchestrates everything |
| Indicator | `Apex_NAS100_Indicator.mq5` | Visual: VWAPs, profile, OB/FVG zones, signals, dashboard |

## Stages
1. **Plan** (this file) ✓
2. **Skill load**: `vibecoding-general-swarm` + `swarm-workspace`; init shared git repo.
3. **Architecture contract**: Orchestrator writes `INTERFACES.md` (struct/class signatures every module must honor) to prevent integration drift.
4. **Parallel implementation** (coder sub-agents on worktrees):
   - Agent A: DeltaFlow + MoneyFlow
   - Agent B: VolumeProfile + VWAP
   - Agent C: MarketStructure + AMD
   - Agent D: OrderBook + Regime
   - Agent E: RiskManager + TradeExecutor
   - Agent F: SignalEngine + SignalRelay
5. **Main EA + Indicator** (coder sub-agent) after modules integrate.
6. **Validation**: static MQL5 correctness review (verifier sub-agent), interface conformance check, logic audit vs requirements checklist.
7. **Package**: folder `ApexNAS100/` with all .mq5/.mqh, `.set` presets (Regular account, Prop firm), README with install/backtest/forward-test guidance.

## Validation gate
Every module must: compile-clean in review (no undeclared identifiers, MQL5-correct API use),
honor INTERFACES.md, and map to at least one user requirement. Fail → redelegate with fixes.
