Blog / Strategy
Strategy

Recurrence Range 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?

Recurrence Range Reversion is a mean-reversion trading strategy whose defining feature is a Recurrence Quantification Analysis (RQA) regime filter — a technique borrowed from nonlinear dynamics that measures how often a price trajectory revisits states it has already occupied. Where most mean-reversion systems simply fade a price that has stretched too far from an average, this strategy adds a statistical gate that asks a deeper question first: is the market actually behaving like a range right now?

The reasoning is grounded in a well-known weakness of mean reversion. Fading a stretched price only pays when the market is stationary — that is, when it keeps returning to the same value region. The same behaviour becomes damaging when a range quietly resolves into a trend, because a fade placed against a breakout can be run over. Common "flat regime" filters such as ADX, flat moving-average slope, or low volatility are blind to that distinction. The recurrence rate measures it directly by embedding recent closes into a two-dimensional phase space and counting how many of the resulting state vectors fall close to one another. A high recurrence rate says the trajectory keeps looping back on itself (a range worth fading); a low rate says the trajectory is escaping (a trend to stand aside from).

As a learning tool, this strategy is well suited to traders who already understand basic mean reversion and want to see how a research-grade regime filter can be layered on top of it. It is designed for range-prone conditions on FX majors such as EUR/USD or AUD/USD on intraday timeframes, but nothing in the code hardcodes a symbol or timeframe. Treat it as a case study in when to apply mean reversion, not merely how.

How It Works

The strategy refreshes its regime measurements once per completed bar and manages open trades on every tick. All calculations are derived from raw closing prices and z-scored, so the measure is unit-independent across symbols and timeframes.

Building the regime measure:

Entry conditions (only while RR is at or above RecurRateMin):

Exit and risk logic:

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

Strategy Parameters

Parameter Default Min Max Description
RecurWindow 48 20 120 Number of closes used to build the phase space and the reversion mean.
EmbedDelay 2 1 6 Embedding delay tau (in bars) for the 2-D state vectors.
RecurEps 0.35 0.10 1.00 Recurrence radius epsilon in z-score units; two states "recur" if closer than this.
RecurRateMin 0.15 0.03 0.60 Minimum recurrence rate (0–1) required to treat the regime as range-bound.
AtrPeriod 14 5 40 ATR period used for the volatility-scaled stretch, stop, and break-even.
StretchAtr 1.6 0.5 4.0 How far (× ATR) the close must sit from the mean before a fade is signalled.
StopAtr 1.0 0.3 3.0 Stop distance (× ATR) beyond the reaction bar's extreme.
BreakevenAtr 0.8 0.2 3.0 Advance (× ATR) in your favour before the stop is pulled to break-even.
Lots 0.10 0.01 1.00 Trade volume in lots.
Magic 5271 0 9,999,999 Magic number that identifies this EA's positions.
recurrence range reversion MT5 EA — MQL5 source code

Recommended Chart Settings

Recurrence Range Reversion was designed with range-prone FX majors in mind — pairs such as EUR/USD and AUD/USD — on intraday timeframes in the M15 to H1 range, where mean-reversion behaviour tends to be more pronounced. Because every calculation is scale-free and every bar reference uses the primary timeframe, the strategy is not hardcoded to any one instrument and can be tested elsewhere. Keep in mind that recurrence structure varies enormously between markets and sessions, so results will differ across symbols, timeframes, and market conditions. Always validate on the specific instrument you intend to study.

How to Install on MetaTrader 5

What to Consider Before Using This EA

The main strength of this approach is that it targets a genuine, well-documented weakness of mean reversion: it only fades when the market's recent trajectory is statistically confirmed to be recurring. The RQA gate is a more direct measure of stationarity than trend-strength proxies like ADX, and the regime guard is designed to cut a fade the moment recurrence collapses — an explicit attempt to keep drawdown contained when a range breaks.

There are real limitations to weigh, however. Recurrence quantification is sensitive to its own parameters: the window length, embedding delay, and radius (RecurEps) all reshape what counts as "recurring," and poorly chosen values can make the gate either too permissive or so strict it rarely trades. Like all mean-reversion systems, it is structurally exposed to sustained trends and sharp breakouts; the regime guard mitigates but cannot eliminate that risk, because a violent move can gap through the stop before the gate reacts. The recurrence rate is a lagging measure computed on closed bars, so it confirms a broken range shortly after the break begins. Finally, thin liquidity, news spikes, and widening spreads can distort both the ATR-scaled distances and the fills. This EA is best treated as an educational framework for studying regime-aware reversion rather than a finished, hands-off system.

Risk Management Tips

Sound risk management matters more than any single indicator. Consider these general principles as you study the strategy:

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