Last updated: May 17, 2026
Capital Defense

Spread Filters: Protecting EAs from Volatility

Trade-Charts IntelUpdate 2026.03

The Logic of the Spread Trap: Why Filters Matter?

In algorithmic trading, especially for scalping strategies that target small profits, the spread is your greatest enemy. A spread that is only 0.5 pips during the day can explode to 10 or 20 pips during the Asian Session Rollover (when the bank's liquidity providers go offline for a few minutes).

If your EA opens a trade during this time without a 'Max Spread Filter', it will immediately start with a massive loss that it can never recover from. A spread filter is a simple piece of logic that tells the EA: 'Do not trade if the spread is wider than X pips'. It is one of the most effective ways to protect your capital from market 'Noise'.

The Rollover Danger: 22:00 - 23:00 GMT

Every day at 5:00 PM EST (New York Close), the major global banks 'Rollover' their accounts to the next day. During this 15-30 minute window, liquidity disappears. Even 'Zero Spread' ECN brokers will see their spreads widen significantly.

Most retail traders do not look at their charts during this time, but automated EAs are 24/5. Without a spread filter, an EA might see a 'Signal' during the rollover and enter at a terrible price. This results in the infamous 'Rollover spike' where an EA's account balance can take a significant hit due to single, poorly-executed trades.

⚠️Danger Zone / Risk Check

Spread Filter Checklist

  • Threshold: Set a maximum allowed spread (e.g., 2.0 pips)

  • Calculation: Ask minus Bid in points

  • Rollover: Automatically pause 10 mins before/after 22:00 GMT

  • Verification: Log the spread in the MT4 'Experts' tab

  • Market State: Only trade during high-liquidity (London/NY) sessions

  • Brokers: Use a 'Raw Spread' ECN account for better results

Coding the Filter: MQL Logic

Implementing a spread filter in MQL4/MQL5 is straightforward. You use the Ask - Bid calculation or the MarketInfo(Symbol(), MODE_SPREAD) function. In your code, you add a conditional check: if (currentSpread > maxSpreadAllowed) return;.

This ensure that the code will simply skip the current trade signal if the market conditions are too expensive. This 'Defensive' coding style is the hallmark of professional algorithmic development and is mandatory for any EA that trades on mid-to-lower timeframes (M1-M15).

The Slippage Correlation

High spreads are often correlated with high slippage. When the spread is wide, it means there are very few buy/sell orders in the 'Order Book'. This means your order is more likely to be filled at a much worse price than what you see on the screen. By filtering for low spreads, you are also indirectly filtering for High Liquidity, which leads to better, faster fills.

Frequently Asked Questions

What is a good max spread for EURUSD?

For a scalper, anything above 1.5 pips is too expensive. For a trend-following H1 system, you can allow up to 3.0 or 4.0 pips. However, if the spread ever exceeds 5.0 pips on a major pair, it is almost always a sign of dangerous volatility or low liquidity, and you should probably avoid trading altogether.

Will this result in missing good trades?

Occasionally, yes. But it is better to miss a 'Potentially' good trade than to enter a trade that starts with a 10-pip deficit. In long-term algorithmic trading, survival is more important than catching every single move. The trades you 'Skip' due to high costs are often the ones that protect your account balance over time.

Recommended Reading