Blog / Strategy
Strategy

Biweight Band Reversion

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?

Biweight Band Reversion is a mean-reversion trading strategy built around the Tukey biweight (bisquare) M-estimator of location — a robust-statistics method for finding a "fair value" price that is deliberately immune to spikes and outlier bars. Instead of anchoring to a moving average, a median, a VWAP, or a trimmed mean (all common tools, and all easily distorted by a few violent candles), the strategy computes an iteratively re-weighted centre in which each bar's influence shrinks with its distance from the middle and drops to exactly zero once it passes a statistically defined cut-off. The result is a centre line that reflects where the "normal" bars agree price belongs — which is precisely the level an over-stretched market tends to be pulled back toward.

The strategy is designed for calm, ranging markets rather than strong trends. It only looks to fade (trade against) a stretch when the robust centre is roughly flat, and it deliberately steps aside when price runs so far that it may be a genuine breakout rather than noise. This makes Biweight Band Reversion a useful case study for anyone learning how robust statistics — the mathematics of estimators that resist outliers — can be applied to price data.

As a learning tool, this EA is best suited to traders who already understand basic order mechanics (stop-loss, take-profit, spreads) and who want to explore how a spike-immune fair-value estimate differs from a conventional moving average. It is not a "set and forget" money tool; it is a transparent, parameter-driven example of one disciplined approach to mean reversion. Treat everything below as analysis, not a profit opportunity.

How It Works

The strategy rebuilds its picture of "fair value" once per newly closed bar, then checks whether the market has stretched far enough to justify a fade. Here is the logic in plain English.

Building the robust centre and bands:

The flat-regime filter (why it stays out of trends):

Long entry — the strategy signals a buy when:

Short entry — the mirror image:

Exit and risk logic:

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

Strategy Parameters

Parameter Default Min Max Description
Window 40 15 150 Number of closed bars used to compute the biweight centre and its dispersion.
TuneC 6.0 3.0 12.0 Biweight tuning constant; the outlier cut-off is TuneC × sigma. Lower values reject outliers more aggressively.
BandMult 2.2 1.0 4.0 Width of the fade band as a multiple of robust sigma.
GuardMult 4.0 2.5 8.0 Outer guard fence in sigma units; a stretch beyond this is treated as a breakout and is not faded.
SlopeLookback 5 2 25 Number of bars over which the centre's slope is measured for the flat-regime gate.
MaxSlope 0.15 0.02 0.60 Maximum absolute centre slope (in sigma units) still counted as a flat, ranging regime.
AtrPeriod 14 5 30 Lookback period for the ATR used in stops, breakeven and reward:risk.
AtrStopMult 1.4 0.5 4.0 Stop-loss distance beyond entry, in multiples of ATR.
BreakevenAtr 0.8 0.2 3.0 Move the stop to breakeven once price travels this many ATR in favour.
MinRewardRisk 0.8 0.3 3.0 Reject setups whose target is closer than this multiple of the ATR stop distance.
MaxSpreadPoints 80 5 300 Skip new entries when the current spread (in points) exceeds this.
Lots 0.10 0.01 1.0 Trade volume in lots.
Magic 4517 0 9,999,999 Magic number identifying this EA's positions.
biweight band reversion MT5 EA — MQL5 source code

Recommended Chart Settings

Biweight Band Reversion is intended for a liquid FX major or a metal (for example a pair like EUR/USD or an instrument like gold) on M5 to H1 timeframes, where robust reversion to a spike-immune fair value tends to be well behaved. The EA runs on whatever timeframe is selected at backtest or attach time — it uses only the primary chart timeframe.

Because the bands, the slope gate, the stop and the breakeven all self-scale (via sigma and ATR), the strategy adapts to changing volatility without manual re-tuning. That said, results will vary considerably across symbols, brokers, spreads and market conditions. A configuration that behaves one way in a quiet ranging period may behave very differently during high-impact news or a strong trend. Always test on the specific symbol and timeframe you intend to study.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Strengths of the approach. The headline idea — a fair-value line that mathematically discards outlier bars — is genuinely different from a moving average and worth studying. The biweight centre does not lurch after a single spike, so the reversion target is more stable than a mean-based one. The flat-regime slope gate and the outer guard fence are sensible attempts to keep the strategy out of trends and breakouts, which are historically where naive mean-reversion systems suffer their worst losses. The breakeven lock and the reward-to-risk filter show an emphasis on keeping individual losses contained.

Known limitations. Mean reversion is, by design, a strategy that "sells calm and buys panic," and its central risk is well known: when a range finally breaks into a real trend, a fade strategy can be caught on the wrong side. The guard fence reduces but does not eliminate this — price can slip through the band, trigger a fade, and then keep going before reaching the guard. The strategy also depends on the market actually being range-bound; in persistently trending or gappy conditions it may signal few trades or a run of losers. Robust estimators need enough data to be meaningful, so very short windows can produce noisy centres, while very long windows may lag regime changes.

Where it may underperform. Expect weaker behaviour around major news releases, during low-liquidity sessions with wide spreads, and in strong directional markets where "fair value" keeps moving. The MaxSpreadPoints filter helps avoid the worst spreads, but slippage and execution quality on your broker still matter. This EA is a structured example for learning, not a guarantee of any outcome.

Risk Management Tips

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