News Protection Utility EA for MT5: Comprehensive User Guide and Input Walkthrough

News Protection Utility EA for MT5: Comprehensive User Guide and Input Walkthrough

20 November 2024, 10:45
Biswarup Banerjee
0
1 164

MT4 Version:

MT5 Version: News Stopper MT5

📦 AutoTrading Helper EA — Free Download (Blog ZIP)

The marketplace version of News Stopper cannot include DLL code. To automatically disable the terminal Algo Trading button (Ctrl+E) during news windows, download and install the companion Helper EA from this page:

  • File: News Stopper AutoTrading Helper.mq5 — included in the ZIP below
  • Required when: DISABLE_AUTOTRADING = true in News Stopper Actions Settings
  • Platform: MetaTrader 5 on Windows only (uses user32.dll for Ctrl+E)

⬇ Download: News-Stopper-AutoTrading-Helper.zip

Upload the ZIP to your MQL5 blog file hosting and replace the link above with your hosted URL before publishing.

Complete User Documentation — MT4 & MT5

1. OVERVIEW

The News Stopper EA automatically closes open trades and pending orders before scheduled high-impact news releases, then optionally resumes normal operation afterward. It pulls data from the built-in economic calendar and lets you define exactly which impact levels (high, medium, low) trigger action, how far in advance to act, and how long to stay paused. This solves the problem of getting caught in sudden volatility spikes that can blow through stops or cause slippage on manual exits.

Who Should Use It: Retail forex traders who hold positions overnight or through news-heavy sessions and want a disciplined, automated way to step aside before events like NFP, FOMC, or CPI without having to sit at the screen.

Main Benefit: You get a consistent, rules-based exit from the market before every major news event you choose, removing emotion and guesswork from one of the highest-risk moments in trading.

AutoTrading lockdown: News Stopper can close your trades during news, but other EAs on the same terminal can still open new trades unless Algo Trading is turned off. For full terminal lockdown, enable DISABLE_AUTOTRADING and attach the free (download above).


2. INPUT PARAMETERS & SETTINGS

This product shares a common set of general input settings with all Expert Advisor products in this series. The following sections are covered in the common guide: General Settings (lot size, SL/TP modes, magic number, trade direction), Breakeven Settings, Trailing Stop Settings, News Filter Settings and News Action Settings, Martingale Settings, Grid Settings, Hedge Settings, Risk Settings, Position Sizing, Alert Settings, Display Settings, Trade Time Settings, Trade Days Settings, Safeguard Settings, and Trend Filter Settings (MA Filter, ADX Filter, RSI Filter, MACD Filter, Parabolic SAR Filter — each with their own strategy options). All of these are fully documented in the Common General Input Settings for Expert Advisors. The sections below cover only the product-specific inputs unique to this product.

General Settings

These settings control the EA's basic scope — which symbols it watches, how it identifies trades, and whether it logs its decisions for later review.

Setting Name Type Default Value Description Example
Enable Symbol Fiter(Current Chart) bool false When enabled, the EA only acts on trades for the symbol currently shown on the chart where it's running. This prevents it from touching positions on other pairs you might want to leave alone during news. true — Use this if you run separate EA instances per chart and want each one to manage only its own pair.

Actions Settings

These settings define what the EA actually does when a news window opens — closing trades, canceling pendings, and optionally signaling the companion Helper EA to disable the platform's Algo Trading button.

Setting Name Type Default Value Description Example
Disable AutoTrading during news window (requires Helper EA) bool false When true, News Stopper publishes a block signal during the news window. The separate AutoTrading Helper EA (blog download) reads that signal and sends Ctrl+E to turn off Algo Trading. This prevents any EA or script from opening new trades while volatility is high. Requires the Helper EA attached on the same account. true — Use this if you run multiple EAs and want a hard stop on all automated trading during NFP or FOMC.
Restore AutoTrading after news window bool true Tells the Helper EA to turn Algo Trading back on once the news window ends. If false, Algo Trading stays off until you enable it manually — even after the block signal clears. true — Keep this on unless you want to manually decide when to re-enable trading after the news passes.

Settings

These display settings let you position and color the news panel that shows upcoming events directly on your chart, so you can see what the EA is watching without opening another window.

Setting Name Type Default Value Description Example
Left margin from chart edge double 12 Controls the horizontal distance of the news panel from the left edge of the chart. Increase this to push the panel rightward if it overlaps with price labels or indicators. 20 — Use when you have a left-aligned indicator panel that clashes with the news display.
X offset double 0 Fine-tunes the horizontal position of the panel relative to the left margin. A positive value shifts it right, a negative value shifts it left. Useful for pixel-perfect alignment. -5 — Use this to nudge the panel slightly left when it's just barely overlapping chart data.
Top double 30 Sets the vertical distance of the panel from the top of the chart. Increase this to move the panel lower, which can help avoid covering the price axis or indicator labels. 50 — Use when your chart has a large top margin or you want the panel below the symbol name.
Y double 20 Fine-tunes the vertical position of the panel relative to the top margin. Use this for small adjustments after setting the main Top value, like centering the panel between chart elements. 15 — Use to nudge the panel up slightly when it's sitting too low after a Top adjustment.
Key Color color clrSkyBlue Changes the color used for labels and headers in the news panel. Pick a color that contrasts well with your chart background. clrWhite — Use on dark chart themes for better readability.

AutoTrading Helper — Two-EA Setup (MT5)

MetaTrader 5 Marketplace products cannot use DLL imports. Pressing Ctrl+E to toggle Algo Trading requires Windows keyboard simulation via user32.dll , so that capability lives in a separate companion EA — not inside the marketplace News Stopper.

File Role Where to get it
News Stopper.mq5 Scans calendar, closes trades, publishes IPC signals via GlobalVariables (no DLL) MQL5 Marketplace
News Stopper AutoTrading Helper.mq5 Reads signals and toggles MT5 Algo Trading via Ctrl+E (uses user32.dll) Blog ZIP download

Helper EA Installation

  1. Download News-Stopper-AutoTrading-Helper.zip from this page and extract the .mq5 file.
  2. Copy News Stopper AutoTrading Helper.mq5 into your MT5 data folder: MQL5/Experts/ (or your Utilities subfolder).
  3. Compile the Helper in MetaEditor (F7) — confirm zero errors.
  4. Attach News Stopper to a chart and configure news filters as usual.
  5. Set DISABLE_AUTOTRADING = true in News Stopper Actions Settings.
  6. Attach the Helper EA to any chart on the same account.
  7. Set MAGIC_NUMBER_INPUT on the Helper to exactly match News Stopper (default: 20131111 ).
  8. Ensure Algo Trading is enabled (green button) before the first news window so the Helper can save and restore that state.

How the Two EAs Communicate

News Stopper and the Helper talk through terminal GlobalVariables scoped by account login and magic number:

GlobalVariable Key Written By Meaning
NS_{login}_{magic}_HB News Stopper Heartbeat — updated every tick when DISABLE_AUTOTRADING = true
NS_{login}_{magic}_Block News Stopper 1.0 = disable Algo Trading, 0.0 = release
NS_{login}_{magic}_Restore News Stopper Mirrors RESTORE_AUTOTRADING setting

During a news window:

  1. News Stopper detects an active news window and runs your configured close actions.
  2. If DISABLE_AUTOTRADING = true , it sets _Block = 1 .
  3. The Helper detects the block and sends Ctrl+E to disable Algo Trading, and hides one-click trading on all charts.
  4. When the news window ends, News Stopper sets _Block = 0 .
  5. If RESTORE_AUTOTRADING = true , the Helper re-enables Algo Trading and restores one-click settings.

News Panel — Helper Status

When DISABLE_AUTOTRADING = true , the News Stopper panel shows an AutoTrading Helper row:

Status Meaning
Connected Helper heartbeat detected — two-EA setup is working
Not detected Helper not running or heartbeat stale — attach Helper EA
Block Active AutoTrading disable signal is currently published

Note: IPC signaling is disabled in Strategy Tester and Optimization. Test the two-EA setup on demo or live.

Quick Checklist

  • ☐ Both EAs compiled with zero errors
  • ☐ Same MT5 account on both charts
  • ☐ MAGIC_NUMBER_INPUT matches on both EAs
  • ☐ DISABLE_AUTOTRADING = true on News Stopper
  • ☐ Helper attached with no init-failure alert
  • ☐ News panel shows AutoTrading Helper : Connected

3. HOW IT WORKS

Core Calculation & Logic

The News Stopper EA doesn't analyze price action or technical indicators — its job is simpler and arguably more critical. It reads the built-in economic calendar, matching upcoming news events against the currency pairs you've listed in the Scan currency pairs parameter. For each event, it checks the impact level (High, Medium, Low) and compares the event time against your configured Minutes Before Stop Trading and Minutes After Resume Trading windows.

Technically, the EA runs a timer loop at the frequency you set in Scan Frequency (default PERIOD_M1, meaning every minute). It pulls event data from a range defined by Data Start From and Data End To — for example, looking 60 minutes ahead and 1440 minutes (24 hours) back. When an event falls within the pre-news window, the EA triggers your chosen actions: closing trades, canceling pending orders, signaling the AutoTrading Helper, or even shutting down the terminal. After the event passes and the resume window expires, the Helper can restore Algo Trading if you've enabled that option.

Entry Strategies Explained

The News Stopper EA does not open trades — it's purely a risk management tool. There are no BUY or SELL signals to configure. Instead, it offers two scanning modes that determine when it checks for news and acts.

Check Every Tick

Behavior: The EA evaluates news conditions on every tick received by the chart. This gives you the fastest possible reaction — useful if you're trading very short timeframes and want to close positions the instant a news event enters the danger window.

Best For: Scalpers and day traders who need split-second precision. Be aware that this mode uses more CPU, especially if you're scanning many currency pairs.

Check Every Period

Behavior: The EA only checks news conditions once per bar or time period (as defined by the chart timeframe). This is much lighter on resources and perfectly adequate for swing traders or anyone who doesn't need millisecond timing.

Best For: Swing traders, position traders, or anyone running multiple EAs on a single terminal. It's my default recommendation unless you have a specific need for tick-level responsiveness.

Step-by-Step Workflow

Step 1: Attach the EA to a chart Drag News Stopper onto any chart — it doesn't matter which symbol, since you'll define the target pairs in settings. Use the M1 or M5 timeframe for best compatibility.

Step 2: Configure currency pairs In the Scan currency pairs field, enter the symbols you want to monitor, separated by commas. Example: EURUSD,GBPUSD,USDJPY,AUDCAD . The EA will check news for all of them.

Step 3: Set your news windows Decide how many minutes before a news event you want the EA to act (Minutes Before Stop Trading, default 5) and how long to wait after the event before resuming normal operation (Minutes After Resume Trading, default 60).

Step 4: Choose impact levels By default, all three impact levels (High, Medium, Low) are enabled. If you only want to react to major events like NFP or FOMC, disable Medium and Low. Most traders I know leave High and Medium on, but skip Low to avoid unnecessary trade closures.

Step 5: Select your actions Under ACTIONS SETTINGS, check the boxes for what you want to happen when news hits. At minimum, enable Close all trades and Close pending orders. The Close Terminal option is drastic — only use it if you want to completely exit MetaTrader.

Step 6: Set alerts Under ALERT SETTINGS, enable the notification methods you prefer. I always turn on Allow Notification (push to phone) so I know what the EA did even when I'm away from the screen.

Step 7: Enable AutoTrading lockdown (optional) If you run multiple EAs, set Disable AutoTrading during news window to true, download the , compile it, and attach it to any chart on the same account with matching magic number. Make sure Algo Trading is green before the first news window.


4. RISK MANAGEMENT FEATURES

The News Stopper EA gives you fine-grained control over what happens when a news event is detected. You can act on individual pairs or across your entire portfolio.

Feature Description
Close Highest Losing Trade (specific pair) Closes only the trade with the largest floating loss on the affected pair. Useful if you want to reduce risk without fully exiting a position you still believe in.
Close all trades (specific pair) Closes every open trade on the pair that has the upcoming news event. Other pairs are left untouched. This is the most common setting — it protects you where it matters without disrupting unrelated positions.
Close pending orders (specific pair) Removes all pending orders (buy stop, sell limit, etc.) on the affected pair. Prevents your orders from being triggered by the volatile spike that often accompanies news releases.
Close all trades (all pairs) A nuclear option — closes every open trade across all symbols. Use this during major global events (like FOMC or NFP) where you expect correlated volatility across multiple markets.
Close Terminal Shuts down MetaTrader entirely. This is extreme — it prevents any trading activity, including manual interference. Only recommended if you want a complete trading halt during critical news.
Disable/Restore AutoTrading (Helper EA) News Stopper publishes a block signal during the news window; the separate AutoTrading Helper EA (blog download) sends Ctrl+E to disable Algo Trading, then restores it when the window ends. Prevents other EAs from opening new trades while you're in the danger zone.

5. TROUBLESHOOTING

Problem Likely Cause Solution
Helper init failed / panel shows Not detected News Stopper not running or magic mismatch Attach News Stopper with DISABLE_AUTOTRADING = true first; match MAGIC_NUMBER_INPUT on both EAs
Algo Trading not disabled during news Helper not attached Download, compile, and attach News Stopper AutoTrading Helper on the same account
Algo Trading stays off after news RESTORE_AUTOTRADING = false Set RESTORE_AUTOTRADING = true on News Stopper, or enable Algo Trading manually
Helper alert on attach News Stopper heartbeat stale Ensure News Stopper is running with DISABLE_AUTOTRADING = true before attaching Helper
AutoTrading toggle does nothing Non-Windows or VPS without focus Helper requires Windows MT5 desktop; Ctrl+E simulation needs terminal focus

Quick Start Guide

Follow these steps to get started in under 5 minutes:

  1. Attach to any chart: Drag the EA onto a chart (M1 or M5 works best). The symbol doesn't matter — you'll define targets in settings.
  2. Set your pairs: In Scan currency pairs, enter the symbols you trade, comma-separated. Example: EURUSD,GBPUSD,USDJPY .
  3. Configure timing: Set Minutes Before Stop Trading to 5 (closes trades 5 minutes before news) and Minutes After Resume Trading to 60 (waits an hour after news before allowing new trades).
  4. Choose impact levels: Keep High Impact and Medium Impact enabled. Disable Low Impact to avoid unnecessary closures on minor news.
  5. Select actions: Enable Close all trades (specific pair) and Close pending orders (specific pair). Leave Close Terminal set to false unless you want a full shutdown.
  6. Enable alerts: Turn on Allow Notification to get push messages to your phone. Also enable Allow Alert for on-screen popups.
  7. AutoTrading lockdown (optional): Set Disable AutoTrading during news window to true, download the Helper EA ZIP, compile and attach it with matching magic number. Panel should show AutoTrading Helper : Connected.

Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Backtest and Set Files

Check all my products: https://www.mql5.com/en/users/biswait50/seller

Contact me for support: https://www.mql5.com/en/users/biswait50 | Email: support@tradingbotmaker.com | Telegram: https://t.me/pops1990

Files: