News Filters in EAs: Avoiding Fundamental Disasters
The Logic of the Spike: Why News Destroys EAs?
Most Expert Advisors (EAs) are based on technical indicators like RSI, Moving Averages, or Bollinger Bands. These indicators assume a relatively 'Smooth' price distribution. However, during high-impact news like Non-Farm Payrolls (NFP) or FOMC Interest Rate Decisions, the market is driven by fundamentals, not technicals.
In these moments, price often 'Gaps' and moves with massive velocity. A technical strategy that works 99% of the time will often fail spectacularly during the 1% of the time when news hits. A News Filter is a protective mechanism that connects your EA to an economic calendar and pauses all trading during these high-risk periods.
How it Works: The External Calendar Connection
MetaTrader 4/5 does not have a built-in economic calendar that an EA can read easily. To implement a news filter, an EA must use WebRequest functions to fetch data from an external API (like ForexFactory or Investing.com).
The EA downloads the calendar, identifies the 'High Impact' events (marked in red), and checks the current broker time against the time of the event. If the time is within, for example, 30 minutes of the news, the EA will 'Suspend' its entry logic. This is the difference between an account-blowing 'Whipsaw' and staying safely on the sidelines.
News Filter Execution Checklist
Primary: Connection to an external news API (e.g., ForexFactory)
Constraint: Filter only 'Red' (High Impact) news events
Threshold: Pause 30 mins before / 30 mins after the event
Market State: Ensure your VPS has 'WebRequest' permissions enabled
Verification: Check the 'Experts' tab for news download status
Symbol: Only filter news related to the currencies you are trading
News States: High, Medium, and Low Impact
A professional news filter allows you to select which level of news to filter. High Impact (Red): Always filter. These are the trend-changers. Medium Impact (Orange): Optional filtering. These produce short-term volatility. Low Impact (Yellow): Usually ignored. These are the 'Noise' events that rarely impact algorithmic performance.
By selectively filtering only the most toxic news, you can protect your account while still capturing the profitable moves that happen during 'Quiet' market periods.
Strategy: Pause vs. Close All Positions
There are two philosophical approaches to news filtering: 1. Pause Entry: The EA simply doesn't open NEW trades but manages existing ones. 2. Close All: The EA closes all open positions 5 minutes before the news and remains flat until the volatility settles. The 'Close All' approach is the safest for 'Grid' or 'Martingale' systems that cannot handle the massive one-way moves that happen during news events.