Blog / Strategy
Strategy

Trimmed Mean Reversion Band

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

The Trimmed Mean Reversion Band is a mean-reversion strategy built around a trimmed mean — a robust statistical estimator of "fair value" — rather than the ordinary moving average that powers most reversion bands. A trimmed mean is calculated by taking a window of recent closing prices, sorting them, discarding a fixed percentage of the highest and lowest values, and averaging only the central core that remains. Because the outliers are thrown away entirely, a single spike bar or a violent news candle cannot drag the centre line around the way it would with a Simple Moving Average (SMA) or an Exponential Moving Average (EMA).

This matters because standard reversion tools — Bollinger Bands, Keltner Channels, envelopes, and disparity indexes — all anchor on estimators that outliers distort in two ways at once: the fat tails pull the centre off true value and inflate the band width, so genuine price stretches stop looking statistically extreme. By building both the centre line and the band half-width from the same trimmed core (using the standard deviation of that core for the spread), the strategy aims for a more stable anchor. That stability is the whole idea, and it is what the design intends to translate into smaller, more controlled drawdowns.

The Trimmed Mean Reversion Band is designed for ranging, sideways market conditions on liquid instruments — it was built and tuned with EURUSD in mind but can be studied on any liquid FX major or metal. It runs on a single primary timeframe. As a learning tool, it suits traders who want to understand robust statistics, regime filtering, and disciplined counter-trend risk management. It is a counter-stretch strategy: it fades price extremes back toward fair value, but only when a trend filter confirms the market is genuinely flat.

How It Works

The strategy recalculates its statistics once per closed bar and manages open trades on every tick. Here is the logic in plain English:

Exit and risk logic:

trimmed mean reversion MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
Lookback 40 15 120 Number of closing prices in the window used to compute the trimmed mean and its spread.
TrimPercent 0.15 0.05 0.35 Fraction of observations trimmed from each tail before averaging the central core.
EntryZ 2.0 1.0 3.5 Band half-width in trimmed standard deviations; controls how far a stretch must reach to signal.
SlopeLookback 5 2 20 Lag (in bars) used by the flat-centre regime gate to measure trend.
FlatSlopeAtr 1.0 0.2 4.0 Maximum allowed centre-line slope (in ATR units) for the market to count as "ranging."
AtrPeriod 14 5 40 Averaging period for the Average True Range (ATR) volatility measure.
StopBufferAtr 0.6 0.1 2.0 Extra padding (in ATR) placed beyond the rejection bar's extreme for the stop-loss.
MinTargetR 0.8 0.3 3.0 Minimum reward-to-risk ratio required before a trade is accepted.
Lots 0.10 0.01 1.0 Fixed trade size in lots.
trimmed mean reversion MT5 EA — MQL5 source code

Recommended Chart Settings

The Trimmed Mean Reversion Band was built and tuned with EURUSD in mind, and it operates on whichever single timeframe you attach it to. Because it fades extremes back to fair value, it tends to be most at home on liquid FX majors or metals where ranging conditions occur regularly and spreads are tight. Mid-range intraday timeframes (for example H1) are a reasonable starting point for study, but there is no universally "correct" chart. Market behaviour differs across instruments, sessions, and volatility regimes, so results will vary considerably from one setting to another. Always test any combination on historical data and a demo account before drawing conclusions.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of the approach. The core idea — using a trimmed mean instead of a plain average — is a genuine and well-established robust-statistics technique. By discarding the fat tails from both the centre and the spread, the strategy resists the distortion that spike bars cause in conventional bands. The flat-slope regime gate is a thoughtful addition: mean-reversion systems are most dangerous in strong trends, and refusing to fade a trending market is exactly the kind of discipline that helps keep drawdowns contained. The tight structural stop, fair-value target, and break-even lock all reinforce that low-drawdown intent.

Known limitations. No filter is perfect. The regime gate reduces trend exposure but cannot eliminate it — a market can transition from flat to trending within a single bar, catching a freshly opened fade on the wrong side. Trimmed statistics also require a reasonable sample; on very short lookbacks or thinly traded instruments the estimate becomes noisy. Because the target is the trimmed mean and stops are tight, the strategy can experience clusters of small losses during choppy, indecisive conditions where reclaims repeatedly fail. Mean-reversion approaches historically underperform in strongly trending or news-driven environments, and this one is no exception despite its guardrails.

Where it may underperform. Expect weaker behaviour during major economic releases, session opens with gapping, sustained directional moves, and low-liquidity periods where spreads widen. The strategy is an analytical framework for studying robust reversion — not a set-and-forget solution. Treat every parameter as a hypothesis to be tested rather than a guarantee.

Risk Management Tips

Sound risk management matters far more than any single entry rule. Consider these general principles as you study this EA:

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog