How to keep your EAs out of high-impact news in MT5 (free news filter)
Most Expert Advisors do not know what an economic calendar is. They trade the minute before Non-Farm Payrolls the same way they trade a quiet Tuesday afternoon. In the seconds around a high-impact release, spreads widen, prices gap and pending orders fill far from their price. Economic News Filter is a free Expert Advisor that reads the economic calendar built into MetaTrader 5 and guards your account around those events.
This guide shows the setup, explains every setting, gives you the code your own EA needs to pause itself, and is clear about what a news filter in MT5 can and cannot do.
1. What News Filter can do – and what it cannot
News Filter watches the calendar for the next 7 days and puts a news window around every event that counts: by default 15 minutes before to 15 minutes after. Overlapping windows merge into one. Inside or just before a window it can:
- alert you 30 minutes before the window, at its start and at its end (on by default);
- delete pending orders on the affected symbols at window start (off by default);
- close positions on the affected symbols at window start – all of them, or only the losing ones (off);
- close or delete trades opened inside the window on the affected symbols, right away (off);
- publish a pause flag – terminal GlobalVariables that your own EAs read before they trade (off).
What it cannot do: stop another program from sending an order. MetaTrader 5 has no way for one EA to block another EA, the mobile app or a manual click before the order reaches the broker. Any news filter that runs as a separate EA can only react afterwards (delete, close) – or ask your EA to stay out, which is what the pause flag is for. News Filter never opens a trade.
2. Setup step by step
- Download News Filter from the MQL5 Market. It appears under Market in the Navigator.
- Make sure the calendar is on: Tools → Options → Server → Enable news must be ticked. The calendar comes with the news feed of your broker's terminal.
- Open one chart (any symbol, any timeframe) and drag News Filter onto it. One News Filter per account is enough – it watches all symbols.
- Leave the inputs at their defaults for the first day. You get the panel, the chart lines and alerts; nothing is deleted or closed.
- Check the panel: the status should read CLEAR or NEWS IN …, and the event list should show the next events. If it says CALENDAR UNAVAILABLE, the terminal has no calendar data yet (see step 2).
- When you want News Filter to act, switch on the actions you need, switch on Algo Trading in the toolbar and tick Allow Algo Trading on the EA's Common tab.
A second copy on another chart of the same terminal shows DISPLAY ONLY and does nothing. If the active copy is removed, its chart is closed or it crashes, the second copy takes over within about 10 seconds. Only one copy can win the hand-over, and a restart or reboot never leaves all copies stuck in DISPLAY ONLY.
3. The settings explained
Calendar
- Impact filter – High impact only (default) or High + medium impact.
- Currencies – AUTO (default): the currencies of the chart symbol and of every symbol on which you have an open position or pending order. Forex pairs use base and quote (EURUSD → EUR, USD). Metals, indices, crypto and stocks use the profit currency, the base if it is a real currency, and USD (XAUUSD → XAU, USD; GER40 → EUR, USD; US30 → USD), unless the broker gives the symbol two fiat currencies (then it is treated like a forex pair); add USD under AUTO: always watch these too if needed. Offshore yuan (CNH) counts as CNY. Manual list: only the currencies you enter, e.g. USD,EUR,GBP.
- AUTO: always watch these too – extra currencies, for example USD,JPY for an EA that has no trade open yet.
- Keywords that also count at medium impact – default Non-Farm,FOMC,CPI,Interest Rate. Matching ignores case, spaces and punctuation, so "Non-Farm" also finds "Nonfarm Payrolls". Events counted this way are marked * on the panel.
- Exclude events containing – default Speaks,Speech. Drops medium- and low-impact events only. A high-impact event always counts, even if it matches.
Events without an exact time (date only, tentative), holidays and worldwide events are ignored.
Window
- Minutes before / after – default 15 / 15; after is at least 1. Start is inclusive, end exclusive: an event at 15:30 gives a window from 15:15:00 to 15:44:59.
Actions
- Alert (on) and alert lead time (30 min).
- Delete pending orders (off) – at window start, orders placed before the window.
- Close positions (off) and which positions – All (default) or Only losing positions, judged at window start (floating profit + swap + the entry commission and fees; the commission for closing is not known in advance and not included). A position that is not closed at the start is left alone for the rest of the window.
- Close / delete trades opened inside the window (off). On a netting account News Filter reads the position's deals: volume added during the window is closed again (only the added part; volume reduced in the window counts against it), and a position reversed during the window is closed completely. Tip: a pending order placed before the window that fills during it becomes a new position and is closed too – switch on Delete pending orders as well.
- Publish the pause flag (off) – see section 5.
When actions run (and Alert is on), you get one popup or push per window; further actions in the same window go to the journal.
Scope
- Magic numbers to act on – empty = all trades, 0 = manual trades only, 12345,777 = only these EAs.
- Never touch these symbols – e.g. BTCUSD,ETHUSD.
- Max close/delete requests per day – default 100, server day, for the whole account. The count is stored in the terminal, so re-attaching News Filter, a takeover by a second copy or a restart does not reset it. Protects you from an endless close loop when another EA keeps reopening trades.
Notifications and panel: popup (on), push to the MetaTrader app (off), sound (off); panel position; vertical chart lines for upcoming events (on).
4. Reading the panel
- Status box: CLEAR (green), NEWS IN mm:ss (window in mm:ss) (amber), NEWS WINDOW until hh:mm server (red), CALENDAR STALE, CALENDAR UNAVAILABLE, NOT CONNECTED (amber). News Filter never shows CLEAR while the calendar data cannot be trusted or the terminal has been offline for more than 5 minutes.
- Tags: ALERT, DELETE PENDING, CLOSE, BLOCK NEW, EA FLAG – lit when on.
- Watching: the watched currencies, AUTO or list. The header of the event list shows the impact filter and the window size.
- Next events: the next 8 events in server time with countdown, currency, impact dot and title (long titles end in "…"; hover the chart line for more). The row of an active window is red and shows LIVE.
- Footer: symbols affected right now, the last calendar update, a note when something prevents the actions (Algo Trading off, market closed, request budget used up), and the requests sent today.
- REFRESH reloads the calendar now. It also reloads every 15 minutes, and every minute after a failure.
All times are your broker's server time – the clock in Market Watch – because that is the time zone of the MT5 calendar.
5. The pause flag: let your own EA stay out of the news
If you have the source code of an EA, the cleanest news filter is the one inside it: the EA simply does not open a trade while a window is active. Switch on Publish the pause flag in News Filter and add this function to your EA (it is also in the manual):
// no News Filter running: failSafe = false -> trade normally, true -> pause bool NewsFilterPause(const string ccy = "", const bool failSafe = false) // ccy "" = any watched currency, or e.g. "USD" { string p = "NEWSFILTER_" + IntegerToString(AccountInfoInteger(ACCOUNT_LOGIN)) + "_"; bool alive = GlobalVariableCheck(p + "HEARTBEAT") && GlobalVariableCheck(p + "CALOK") && GlobalVariableGet(p + "CALOK") > 0.5 && TimeCurrent() - (datetime)GlobalVariableGet(p + "HEARTBEAT") <= 120; if(!alive) return failSafe; string n = p + (ccy == "" ? "PAUSE" : "PAUSE_" + ccy); return GlobalVariableCheck(n) && TimeCurrent() < (datetime)GlobalVariableGet(n); } // in OnTick, before opening a trade: if(NewsFilterPause()) return; (fail-open) // if(NewsFilterPause("", true)) return; ("no News Filter, no trading")
How it works:
- News Filter writes NEWSFILTER_<login>_PAUSE = the end of the active window (server time as a number), or 0 when clear. NEWSFILTER_<login>_PAUSE_USD, _EUR … do the same for each currency, so a gold EA can ask only for USD.
- CALOK is 1 only while the calendar data is current and the terminal is connected. HEARTBEAT is refreshed every 10 seconds – but only while CALOK is 1.
- The function first checks that News Filter is alive: heartbeat present, CALOK = 1, heartbeat younger than 120 seconds. If not, it returns failSafe: with false your EA trades normally without News Filter, with true it pauses ("no News Filter, no trading").
- Then it compares the flag with TimeCurrent(). Because the flag holds the window end, a crashed News Filter can never leave your EA paused forever, and a removed News Filter never says "clear" by mistake.
- GlobalVariables belong to one terminal. An EA in another terminal or on another VPS sees no heartbeat, which means "no News Filter". You can see the variables with F3.
In the Strategy Tester the MT5 calendar does not exist, so News Filter does nothing there. To test your EA's news logic, set the GlobalVariables yourself in the tester.
6. Keep it running: VPS
Alerts, deletes, closes and the heartbeat only happen while the terminal runs and is connected. If your PC sleeps through Non-Farm Payrolls, so does News Filter. A VPS keeps the terminal online around the clock. For the pause flag, News Filter must run in the same terminal as your EAs. More on VPS options for MetaTrader: algoverdict.com/en/vps.
7. FAQ
Will News Filter stop my EA from trading during the news? Not by itself. It can close or delete what your EA opens inside the window (if you switch that on), and it publishes the pause flag. Only an EA that reads the flag stays out before it sends an order.
Which time zone does the panel use? Your broker's server time, the same as the chart and Market Watch. The MT5 calendar is stored in server time, including the broker's daylight-saving changes.
Why does it say NO CALENDAR IN STRATEGY TESTER? MetaTrader 5 has no economic calendar in the tester. News Filter runs there without errors and does nothing.
The panel says CALENDAR UNAVAILABLE. The terminal has no calendar data. Check Tools → Options → Server → Enable news and the connection. Some brokers' terminals deliver no news feed; then there is no data.
Who decides which events are "high impact"? The importance rating in the MT5 calendar. With the keyword list you can add medium-impact events that matter to you; with the exclude list you can drop medium- and low-impact ones.
What does the * in the event list mean? The event is medium impact and counts because its title contains one of your keywords.
Why was my pending order closed after it filled? It was placed before the window and filled during it, so it became a new position inside the window and the "opened inside the window" action closed it. Switch on Delete pending orders to remove such orders at window start.
Netting or hedging account? Both work. On a netting account there is one position per symbol, shared by every EA and manual trading; closing it affects all of them. With Close / delete trades opened inside the window, volume added during the window is closed again (only the added part), and a position reversed during the window is closed completely. Use a hedging account if several EAs trade the same symbol and you want them treated separately.
Does it close partially? No. Positions are closed fully (above the broker's maximum volume in maximum-volume pieces).
Does it work on prop-firm accounts? It alerts and, if you switch it on, deletes and closes around the news. Whether that satisfies a firm's news rule depends on the firm. If you trade a prop-firm account and want the firm's news rule together with its daily and max loss limits in one EA, look at Prop Firm Guard Plimsoll.
8. Tested before release
Strategy Tester on a RoboForex demo account, 9 October 2026, with the final build after an external code review by three AI models from other providers (GPT, Gemini, DeepSeek): the built-in self-test passed 162 of 162 checks (EURUSD M5), and validator-style runs of the Market build on EURUSD H1 (real ticks) produced 0 error lines (earlier versions also on XAUUSD D1 and USDJPY M30). The calendar logic itself cannot run in the tester (no calendar there); the self-test checks it with synthetic events, and on the live demo the calendar loads and lists the coming EUR and USD events.
9. Further reading
- Why EAs need a news filter and the options in MT5 compared: News filters for EAs – guide on AlgoVerdict
- News Filter with screenshots and examples: Economic News Filter – guide on AlgoVerdict
Risk warning: trading leveraged products carries a high risk of loss. A news filter reduces exposure to news events only as far as the actions you switch on allow; it cannot remove the risk and does not guarantee any result.
Pitt Petruschke (PiP)
![[EURUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026 [EURUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026](https://c.mql5.com/6/1035/splash-preview-777305.png)
![[XAUUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026 [XAUUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026](https://c.mql5.com/6/1035/splash-preview-777299.png)
![[Nasdaq]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026 [Nasdaq]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026](https://c.mql5.com/6/1035/splash-preview-777311.png)