News Filter for MT5 EA — No Code
Can you add a news filter to an MT5 EA without coding?
Not in AlfaTactix. The MT5 Strategy Builder has no news or economic-calendar filter. Its Step 4 market filters are ATR volatility, market session, time range and liquidity (spread limit, spread widening, volume). None of them reads the calendar.
A true news blackout ("no new trades while a high-impact USD event is near") needs MQL5 code that reads the Economic Calendar: write it by hand, or add it to the .mq5 you export from Code Generator. The builder's spread and time filters can soften news risk, but they are not a news filter (see below). For prop-firm rule context, see Prop Firm EA Rules.
Related guides: Advanced EA MTF & Filters · Convert Manual Strategy to EA · FTMO Challenge EA — No Code · Scalping EA
Why News Filters Matter for EAs
Manual traders often stand aside before NFP, CPI, or central-bank decisions. An EA without that habit will:
- Enter into spread spikes and slippage
- Hit stop loss on wicks that do not repeat in backtest
- Breach prop firm news rules even when the strategy is profitable in quiet hours
MetaQuotes documents calendar access in MQL5 via Calendar functions [1]. That is where a real news filter lives.
Economic Calendar in MQL5
A hand-written news blackout usually follows these steps before each new entry:
- Call CalendarValueHistory [2] for a window around now (for example 30 minutes before to 30 minutes after), filtered by the currencies of your symbol (EURUSD → USD and EUR).
- For each value, read the event with CalendarEventById and keep only high-importance events (CALENDAR_IMPORTANCE_HIGH).
- If any remain, skip the entry. Open positions keep their stop loss; the filter only gates new trades.
MqlCalendarValue values[];
datetime now = TimeTradeServer();
if (CalendarValueHistory(values, now - 30 * 60, now + 30 * 60, NULL, "USD") > 0)
{
for (int i = 0; i < ArraySize(values); i++)
{
MqlCalendarEvent ev;
if (CalendarEventById(values[i].event_id, ev) && ev.importance == CALENDAR_IMPORTANCE_HIGH)
return; // high-impact USD event in the window: no new entry
}
}
Gold (XAUUSD) tip: USD events often move gold as much as FX — check USD even on XAUUSD charts. See Gold RSI EA.
What the Builder Can Filter Instead
These Step 4 filters exist in the MT5 form. They help around news, but none of them knows the calendar:
| Filter | What it does | Limit around news |
|---|---|---|
| Liquidity: spread limit / spread widening | Skips entries when the spread is above your limit or widening | Reacts to the spread after it widens, not to the scheduled event |
| Time range | Allows or blocks a fixed time window on the weekdays you pick | Applies the same window every selected weekday, not only on event days |
| Market session | Trades only the sessions you choose | Major releases often fall inside London / New York |
| ATR volatility | Skips entries when volatility is outside your range | Reacts after volatility rises |
Use them as a first layer; add the calendar check in MQL5 if your strategy or your prop firm requires a real blackout.
Combine Session, Spread, and News
| Filter | Blocks | Where |
|---|---|---|
| Market session | Quiet Asian hours if you only trade London/NY | Builder, Step 4 |
| Spread | Wide spread around rollovers and releases | Builder, Step 4 |
| Economic Calendar check | Scheduled high-impact releases | Your MQL5 code |
Full filter patterns: Advanced EA MTF & Filters.
Prop / FTMO builds: Pair this article with FTMO Challenge EA Without Coding — rules live in Prop Firm EA Rules, not duplicated here.
Export, Compile, Backtest Limits
- Strategy Tester: Every tick, realistic spread, 6–12 months.
- Compare trade count with vs without the news check — entries should drop on event-heavy weeks.
- Forward test on Demo through at least one known release week.
Honest limit: Historical calendar data in the Tester may be missing, or may not match broker server time or later revisions. Treat backtest as logic validation, not proof of prop compliance.
Hand-coded calendar patterns: Prop Firm EA Rules — News Filter.
Tactix AI on this workflow
AlfaTactix includes Tactix AI: use Tactix Studio to describe your idea in plain language and draft timeframes, signals, filters, and risk into the same six-step Strategy Builder form — or open Tactix Guide on any step when you only need a field explained. Review every value, then export MQL5 or Pine Script from Code Generator (form-first — not untested prompt-to-code).
Next Steps
| Goal | Link |
|---|---|
| Automate full manual playbook | Convert Manual Strategy to EA |
| FTMO-style challenge EA | FTMO Challenge EA — No Code |
| Firm drawdown + news code | Prop Firm EA Rules |
| Platform overview | Build EA Without Coding |
News hour test: Note the next high-impact USD event on your calendar. Run your EA on Demo through it and check the journal: if a new trade opened inside your blackout window, fix the calendar check before going live; a news guard that silently fails is worse than none.

