News Filter for MT5 EA — No Code
Can you add a news filter to an MT5 EA without coding?
Not yet. The MT5 Strategy Builder has no news or economic-calendar filter; news and fundamental filters are not available yet. Its Step 4 filters are sessions, time ranges, spread, correlation and your own conditions (up to 8 filters). 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 · Prop Firm EA Rules (FTMO) · 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 behaves well 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 |
|---|---|---|
| Spread | Skips entries when the spread is above your limit | 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 |
| Your own ATR condition | 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: The rules live in Prop Firm EA Rules (FTMO), 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.
Next Steps
| Goal | Link |
|---|---|
| Automate full manual playbook | Convert Manual Strategy to EA |
| Firm drawdown + news code (FTMO-style) | Prop Firm EA Rules (FTMO) |
| 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.

