Blog / Strategy
Strategy

Roofing Filter Cycle 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?

Roofing Filter Cycle Reversion is a cycle mean-reversion strategy built around John Ehlers' Roofing Filter, a two-stage band-pass filter borrowed from digital signal processing (DSP). A mean-reversion approach assumes that when price swings too far from its recent center, it tends to snap back — and this strategy tries to time that snap-back at genuine cycle turning points rather than at arbitrary "overbought/oversold" readings.

The core idea is that any price series can be thought of as three layered components: a slow-moving trend (very low frequency), a tradable swing cycle (the medium frequency you actually want to fade), and noise (very high frequency, mostly spread and tick jitter). Classic oscillators that fade extremes often fail because the trend component leaks straight through them, so their "extremes" are really just trend artefacts. The Roofing Filter removes both ends of the spectrum — a high-pass filter strips out the trend and DC drift, and a super-smoother (a Butterworth-style low-pass) strips out the noise. What remains is a clean wave that genuinely oscillates around zero, so its peaks and troughs correspond to real cycle turns.

This EA is best understood as a learning tool for traders curious about DSP-based indicators, filter design, and disciplined mean-reversion logic. It suits students of technical analysis who want to see how band-pass filtering, z-score normalization, and ATR-based risk brackets fit together in a single, transparent system. It is not a shortcut and not a signal service — it is a worked example of one well-defined trading idea.

How It Works

The strategy processes one signal per newly closed bar on the chart's timeframe. Each closed bar is pushed through the recursive filter chain, and only then are entry rules evaluated. Here is the full pipeline in plain English:

The strategy then fades the re-entry from an extreme — a confirmed turn, not a naked touch of the band — with fully symmetric long and short rules:

Risk is handled with an ATR (Average True Range) bracket, where ATR is a volatility measure:

Every calculation runs on a single timeframe — whichever chart the EA is attached to — so no higher- or lower-timeframe data is hardcoded.

roofing filter cycle reversion MT5
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
HighPassPeriod 48 20 120 High-pass cutoff in bars; swings slower than this are treated as trend and removed.
SmoothPeriod 10 4 30 Super-smoother period in bars; movement faster than this is treated as noise and removed.
NormWindow 50 20 200 Rolling window length used to z-score (normalize) the roofing output.
Threshold 1.0 0.4 2.5 Sigma band (in standard deviations) the cycle must exit to trigger a signal.
AtrPeriod 14 5 30 ATR lookback period used for the volatility-based stop.
AtrStopMult 1.5 0.5 4.0 Stop distance as a multiple of ATR, placed beyond the entry price.
RewardRisk 1.2 0.6 3.0 Take-profit distance as a reward-to-risk multiple of the ATR stop.
MaxSpreadPoints 60 5 300 Skip entries when the current spread (in points) is wider than this.
Lots 0.10 0.01 1.0 Trade volume in lots for each position.
Magic 5150 0 9,999,999 Unique magic number the EA uses to identify and manage its own trades.
roofing filter cycle reversion MT5 — MQL5 source code

Recommended Chart Settings

Roofing Filter Cycle Reversion is designed for liquid, mean-reverting instruments on an intraday timeframe. Its natural home is a symbol such as EURUSD or XAUUSD, or a major index, on the M15 to H1 range. Liquidity matters here: the spread guard and ATR bracket assume reasonably tight, orderly conditions, which is where band-pass mean reversion tends to behave most predictably.

Because the timeframe is never hardcoded, the EA runs on whatever chart period you attach it to. That flexibility also means results will vary considerably across symbols, timeframes, and market regimes. A setting that produces clean cycle turns on one instrument may generate noisy or infrequent signals on another, so any change of symbol or timeframe should be studied on its own before use.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every trading approach involves trade-offs, and understanding them is part of learning to use any tool responsibly.

Strengths of this approach:

Known limitations:

Treat this EA as a framework for studying how filtering and normalization change signal quality — not as 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