# PropNewsSpreadGuard (MT5 Expert Advisor) Standalone, zero-DLL **MetaTrader 5** risk-protection utility engineered for algorithmic and prop-firm traders running automated EAs across major FX pairs and metals (`EURUSD`, `GBPUSD`, `USDJPY`, `XAUUSD`, `XAGUSD`). Maintained by **[ForexNewsRadar](https://www.mql5.com/en/users/forexnewsradar)**. --- ## Live Chart HUD Preview ### 1. Calm Market (`SAFE · CLEAR`) ![PropNewsSpreadGuard Calm HUD](screen1_safe_hud.png) ### 2. Active Macro / Spread Shock (`DO NOT TRADE · VETO`) ![PropNewsSpreadGuard VETO Sweep HUD](screen2_veto_sweep.png) --- ## Core Architecture 1. **Pre-News & Post-News Blackout (`T-5m` / `T+5m`):** Reads the native MetaTrader 5 Economic Calendar (`CalendarValueHistory`) for currencies matching the chart symbol (including automatic `USD` mapping on `XAUUSD` / `XAGUSD`) and activates a configurable pre-release and post-release cooldown window. 2. **Dynamic Spread-Spike & Liquidity Vacuum VETO:** Computes a calm-regime rolling EMA of live broker spread (`SYMBOL_SPREAD`) without polluting the baseline during news spikes, triggering `SPREAD_VETO` whenever spread breaches either your hard point cap (`InpMaxSpreadPoints`) or dynamic multiplier (`InpSpreadSpikeMultiplier`). 3. **Non-Destructive Pending-Order Sweeper:** Optionally clears unfilled pending stop/limit orders (`Buy Stop`, `Sell Stop`, `Buy Limit`, `Sell Limit`) during active `PRE_NEWS` or `SPREAD_VETO` windows while **never closing or modifying already open positions**. Supports filtering by `MagicNumber` (`-1` = all pending orders on symbol). 4. **Cross-EA Terminal RAM Bridge (`GlobalVariableSet`):** Publishes `FNR_GUARD_SAFE_` (`1.0` = safe to open new trades, `0.0` = stand aside) and `FNR_GUARD_STATE_` every second so any custom EA in the same MT5 terminal can gate new entries with a single `GlobalVariableGet()` check and zero file or DLL overhead. --- ## Installation & Quick Integration 1. Copy `PropNewsSpreadGuard.mq5` into `MQL5/Experts/` and compile in MetaEditor (`0 errors, 0 warnings`). 2. Attach to any FX or metal chart (`Enable Algorithmic Trading` checked). 3. *(Optional)* Gate entries inside your own EA via the terminal RAM variable: ```mql5 string guardKey = "FNR_GUARD_SAFE_" + _Symbol; if(GlobalVariableCheck(guardKey) && GlobalVariableGet(guardKey) < 0.5) { // Active Pre-News or Spread-Spike VETO — skip new entry return; } ``` --- ## Author * **MQL5 Profile:** [ForexNewsRadar](https://www.mql5.com/en/users/forexnewsradar)