Oleh William Harris · Terakhir ditinjau
How to Filter News Events in Your Forex EA (Calendar API + filter logic)
Apa yang Anda butuhkan
- • EA with built-in news filter, OR a separate news-watcher EA
- • Economic calendar source (ForexFactory CSV or MT5 built-in)
- • Timezone reference (broker time vs UTC vs your local)
Instruksi langkah demi langkah
Langkah 1: Why news filtering matters
Major economic news (NFP, FOMC, CPI, ECB rate decisions) cause sudden, large price movements that break most EA assumptions:
• Spreads widen 5-20× during the first 30 seconds of a release. Scalpers face fills 0.5-3 pips worse than expected. • Stop losses get gapped through. A 30-pip stop on EURUSD becomes 60-150 pip realized loss during NFP because price 'jumps' past the stop without filling. • Liquidity providers temporarily pull quotes. Orders may be rejected with 'Off quotes' or 'Trade context busy' errors. • Some brokers reduce leverage during high-impact news (e.g. 1:30 → 1:5). Existing positions may margin-call instantly.
The risk is asymmetric — news typically hurts EAs more than it helps. The right default for any EA running unattended is to disable trading during the highest-impact windows.
Langkah 2: Pick a calendar source
Three options, in order of EA-integration ease:
1. MT5 built-in calendar (since build 1750) — accessible via CalendarValueLast(), CalendarEventByCurrency() etc in MQL5. No external dependencies; updates from MetaQuotes' server. Pros: native, free, no setup. Cons: occasionally lags ForexFactory by 5-30 minutes; coverage is good for major currencies but thin for exotic crosses.
2. ForexFactory CSV/RSS — the de facto standard for retail. Download the weekly CSV from forexfactory.com/calendar. Pros: comprehensive, well-categorized by impact, includes forecast vs actual data. Cons: requires the EA to download the CSV periodically (every 6-24 hours typical) and parse it.
3. Paid feeds (Trading Economics API, FXStreet API) — higher accuracy and more events. Pros: institutional-grade. Cons: $50-500/month, overkill for retail.
For a typical retail EA, the MT5 built-in calendar is sufficient. For prop-firm challenges where rule compliance matters, use both as cross-check — one event missed in either feed could cost you the challenge.
Langkah 3: Configure impact-level filtering
Calendar events are tagged with impact levels: Low (gray on ForexFactory), Medium (yellow), High (red). Filtering strategy:
• High-impact only — close positions 30 min before / 15 min after. Targets NFP, FOMC, ECB, BOE, BOJ rate decisions, CPI, GDP. About 10-15 events per month per major currency.
• High + Medium — filter both, but use tighter window for Medium (15 min before / 5 min after). Adds about 20 more events per month. Recommended for scalpers and prop firms.
• All levels — too many events to be practical; EA effectively stops trading. Only use for ultra-conservative or news-explicitly-banned setups.
Most EAs default to High-only. If you're running a tight prop-firm challenge, switch to High+Medium for safety. The lost trading opportunity is small (~5% of total trading windows); the avoided execution risk is much larger.
Currency filter: most EAs filter only events affecting the symbol's currency. EURUSD EA filters Euro Zone + US events; it ignores Japanese events. This is the right default — events affecting unrelated currencies don't move your symbol much.
Langkah 4: Set the right time window
Standard windows for high-impact news:
• 30 minutes before — close all open positions. The pre-news spread widening starts here. Open positions get closed at the EA's market-on-close logic; new orders are blocked.
• 15 minutes after — disable new orders. The post-news volatility takes 5-15 minutes to settle. Most stop-hunt moves happen in this window.
• Resume — allow normal EA operation.
Wider windows for ultra-cautious setups: 60 min before / 30 min after. Costs more trading opportunity; safer execution.
Narrow windows for aggressive scalpers who want to trade post-news momentum: 5 min before / 1 min after. Use only with EAs explicitly designed to handle news volatility.
For multi-event days (FOMC + simultaneous Powell speech), the windows overlap. Most filters compute the union of all windows and treat them as one continuous no-trade period. Confirm your EA does this rather than treating each event independently.
Langkah 5: Use the EA's built-in news filter if available
Most modern commercial EAs have built-in news filters. Look in the Inputs tab for: 'NewsFilter', 'NewsCalendar', 'PauseDuringNews', 'NewsHandling'.
Common configuration patterns: • NewsFilter = true/false — master toggle. • MinutesBeforeNews = 30 — pre-news window. • MinutesAfterNews = 15 — post-news window. • NewsImpactLevels = High / Medium+High / All — which events to filter. • NewsCurrencyFilter = SymbolOnly / All — currency relevance filter. • CalendarSource = MT5 / ForexFactory / Both — feed source.
Verify the filter actually works on demo: pick a known upcoming high-impact news event, leave the EA running, observe the Experts log for messages like 'News pause: 14:00 USD NFP' starting 30 minutes before. If you don't see the log message, the filter isn't engaging — investigate.
If the EA's filter is broken or incomplete (e.g. doesn't handle FOMC dates correctly), use a separate news-watcher script instead.
Langkah 6: Run a separate news-watcher EA (if needed)
When your primary EA lacks a news filter, install a parallel 'News Filter Manager' EA from the MQL5 Code Base. These free utilities work alongside your trading EA:
• On news window start — they programmatically disable global AutoTrading (terminal-wide). Your trading EA stops because of the global toggle. • On news window end — they re-enable global AutoTrading.
Popular free options on MQL5 Code Base: 'News Filter Manager', 'No Trade During News', 'Calendar Pause'. Search for the EA name and read recent reviews for current quality.
The watcher EA attaches to any chart (it doesn't trade itself). Configure with: calendar source (usually FF CSV download URL), impact levels, time window, currency filter.
The trade-off vs built-in filter: built-in is more reliable (no inter-EA coordination), but watcher EA gives you one filter for many EAs and is easier to audit/update than relying on each EA's individual filter. Most multi-EA setups use a single watcher to enforce uniform news policy.
Langkah 7: Validate the filter on demo through real news
The only way to verify the filter works is to observe it during real news. Process:
1. Identify the next NFP date (first Friday of every month, 13:30 UTC release). This is the highest-impact recurring event.
2. Run your EA on demo through that week. Monitor the Experts log from 12:30 UTC onwards (60 min before).
3. At 13:00 UTC you should see filter activation: log messages, all open positions closed, no new trades despite signal logic firing.
4. At 13:45 UTC (15 min after NFP), filter deactivates: trading resumes.
5. If any of these steps don't happen as expected, the filter is misconfigured or broken. Fix before going live.
Common failures during this test: • Filter doesn't trigger because the calendar feed didn't include the event. Check the calendar source. • Filter triggers but the EA still places a trade. The EA's filter integration is buggy; contact vendor. • Filter triggers but positions don't close. The EA has 'pause new trades' but not 'close existing'. Adjust expectations or switch EAs. • Filter triggers at the wrong time (e.g. 14:30 instead of 13:00 UTC). Timezone mis-configuration; verify the calendar source's timezone matches your EA's expectation.
Kesalahan umum yang harus dihindari
- ✗ Disabling news filter to 'maximize profit'Perbaikan: Single bad NFP can wipe out a month of profit. Filter is non-negotiable for unattended live trading.
- ✗ Only filtering High-impact when prop firm rules require Medium tooPerbaikan: Read the firm's rules. Some require All-impact news compliance; default to Medium+High for safety.
- ✗ Filtering only the symbol's primary currencyPerbaikan: EURUSD is affected by both EUR and USD news. Make sure both currency feeds are in the filter.
- ✗ Trusting a calendar source without daily verificationPerbaikan: Calendar APIs occasionally miss events or have wrong times. Cross-check 2-3 sources weekly.
- ✗ Not closing existing positions before news, only blocking new onesPerbaikan: Open positions get hit by the news spread widening. Close existing positions 30 min before high-impact.
- ✗ Filter window too narrow (5 min before / 0 min after)Perbaikan: News spike volatility lasts 5-15 minutes. Use 30 / 15 standard or 15 / 5 minimum.
Pertanyaan yang sering diajukan
What's the difference between Low, Medium, and High impact news?
The classification is editorial — different calendars sometimes disagree on whether an event is Medium or High. The systematic approach: pull from one source and don't second-guess. ForexFactory is the de facto standard for retail; MT5's built-in calendar uses MetaQuotes' own classification which roughly matches. Use whichever source your EA already integrates with.
Why does news time matter so much for EAs?
Most filter bugs are timezone bugs. ForexFactory publishes in your selected timezone (set in your forum profile); the EA may parse assuming a fixed timezone. MT5 calendar uses broker time (or UTC depending on configuration). When configuring, explicitly verify: write down the next NFP time in UTC, convert to your broker server time, then check whether the EA's filter activates at the right local-time minute.
Do I need to worry about weekend news?
MetaQuotes' calendar includes some weekend events (Chinese PMI on Sundays). The filter logic should treat these as a pre-Sunday-open window: close Friday positions, don't open new ones over the weekend. If you're using a third-party news source that doesn't include weekend events, supplement manually for known upcoming weekend events (G20 summits, central-bank surprise actions).
How do I handle unscheduled central bank speeches?
Some institutional EAs include a 'central-bank-speech-detector' that polls a news API every 5 minutes for newly-scheduled speeches. Retail EAs rarely have this. The fallback is your daily routine: check the calendar in the morning, note any new speeches, and either manually pause the EA or trust the post-speech volatility to be lower than scheduled events. Most non-scheduled speeches cause only 5-15 pip moves; scheduled rate decisions cause 30-150 pip moves.
What about EAs that explicitly trade the news (news scalping)?
News-trading EAs typically pre-position 1-5 minutes before scheduled releases and execute on the price movement immediately after. Slippage and spread widening are bigger risks than for normal EAs. Most prop firms explicitly ban news-trading strategies (even when EAs are otherwise allowed). For retail accounts, news-trading is risky but viable if you have the broker setup and the EA's been validated against many news events. For most traders, the right move is to filter news, not trade it.
What are the highest-impact recurring events I should always filter?
These 8-10 event types account for ~80% of high-impact market moves. If you can't filter the calendar dynamically, even a hardcoded list of these events with their published schedules provides 80% of the protection. Updates to schedules happen annually; check the official central bank pages each January for the current year's meeting dates.
News filter set up — ready for prop firm or full live?
If pursuing prop-firm funding, the news filter is one of the rules-compliance pillars. Our prop-firm guide covers the rest.
Continue to: How to pass a prop firm with an EA →Panduan terkait

William Harris
Pendiri & Lead Developer FxRobotEasy
Chicago, Amerika Serikat · Sejak 2021
- 12+ Tahun Trading Live
- 10+ Tahun MQL5 / MQL4
- 3 Expert Advisor yang Diverifikasi Live
- Didirikan 2021
“Saya telah membangun hal-hal dengan kode sejak SMP. Saya trading sejak kuliah. Persimpangan kedua dunia itu — algoritma, pasar, dan teknologi yang menghubungkannya — adalah tempat saya menghabiskan lima belas tahun terakhir. FxRobotEasy adalah apa yang terjadi ketika Anda menolak untuk berhenti sampai hal yang Anda bayangkan benar-benar bekerja di akun broker live.”