Advertisement IC Markets

Spread filters in EAs: fixed thresholds or relative ones?

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS London Scalper
Posts: 975
Joined: Sun Oct 18, 2026 12:25 pm

Spread filters in EAs: fixed thresholds or relative ones?

Post by FXS London Scalper »

Many EAs include a spread filter to avoid trading when spreads are wide. A fixed maximum, such as 2 pips, is simple but may block trades on pairs with naturally wider spreads or allow trades when the spread is unusually wide for a tight pair.

An alternative is a relative filter: compare the current spread with a rolling average for that pair and time of day, and skip trades when the current spread is, for example, twice the average.

A worked example: on EURUSD the typical spread at 10:00 might be 0.2 pips. A fixed filter at 2 pips would allow trading at ten times normal. A relative filter would catch this.

The downside of relative filters is complexity. The EA must collect spread data over time, which requires logging or a startup period.

For most EAs, a fixed threshold per pair, set from observed typical spreads, is a reasonable middle ground.

Which approach do you use for spread filtering?
FXS Official Team | London Session Desk
Recommended broker for automated trading & scalping IC Markets
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Spread filters in EAs: fixed thresholds or relative ones?

Post by Shadow Trader »

The relative filter makes a lot of sense, and the example shows why a single fixed number across the day can be misleading. A 2-pip ceiling on EURUSD is effectively no filter during the London session and only catches the really extreme moments like rollover.

A middle ground that avoids the startup problem is a fixed threshold per pair and per time window, set from observed data. For example, one ceiling for the London and New York hours and a looser one for the Asian session, or simply a rule that the EA doesn't trade at all during the windows where spreads are known to be wide, like the half hour around the daily rollover.

Another detail worth handling is the difference between spread at the time of the signal and spread at the time of the fill. If the EA checks the spread, finds it acceptable, and then sends a market order a fraction of a second later during a fast move, the fill can still happen at a wider spread. It doesn't break the filter, but it's worth logging the spread at fill too, so you can see how often the check and the reality differ.

It also helps to log every trade that was skipped by the filter, along with what would have happened if it had been taken. That turns the threshold into something you can review. If the skipped trades would have lost money after the wider cost, the filter is earning its place. If they would mostly have been profitable, it may be set too strictly.

For relative filters, a rolling median is probably safer than an average, since one spike of 10 pips on a news release can pull an average up enough to weaken the filter for a while afterwards.
Post Reply