Blog / Strategy
Strategy

Trend Purity Pullback

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 Trend Purity Pullback strategy is a selective, trend-following pullback system for MetaTrader 5 built around an original core measure the author calls Trend Purity, combined with a baseline EMA (Exponential Moving Average) — a moving average that weights recent prices more heavily than older ones. Instead of asking only how far price travelled or how straight the path was, Trend Purity asks the question a risk-conscious trader actually cares about: while the market trended, how badly did it ever move against a position? This makes the strategy a study in trade quality rather than raw signal frequency.

Trend Purity is calculated over a window of recent closing prices. The strategy takes the net displacement of price across the window, then measures the worst counter-excursion along that path — the deepest drop below the running peak in an uptrend, or the highest rise above the running trough in a downtrend. This worst counter-move is a form of Maximum Adverse Excursion (MAE), the largest unrealised loss a trade would have experienced. Purity is then defined as |displacement| / (|displacement| + MAE), a scale-free number between 0 and 1. A value near 1.0 describes a clean trend that marched one direction with only shallow pullbacks; a value near 0 describes a choppy, whipsaw-prone move dressed up as a trend.

This approach is designed for traders who want to study how a trend-pullback system filters for clean, orderly trends and enters on shallow retracements rather than chasing breakouts. It is best suited as a learning tool for intermediate students exploring how a custom trend-quality metric, a moving-average pullback trigger, and structural risk management fit together. It is not a shortcut of any kind — it is a framework for understanding disciplined, selective trend entries.

How It Works

The strategy processes each completed bar on a single timeframe and evaluates a sequence of conditions. It is fully symmetric, meaning the same logic applies to both long (buy) and short (sell) setups in mirror image.

Regime filter (is this a clean trend?):

Pullback (wait for a discount):

Reclaim trigger (the entry bar):

Stop-loss logic (structural and strict):

Take-profit and trade management:

Trend Purity Pullback MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
Lookback 20 8 60 Window, in completed bars, over which Trend Purity is measured.
PurityThreshold 0.60 0.45 0.85 Minimum Trend Purity (0–1) required to call the trend "clean".
BasePeriod 21 8 80 Baseline EMA period — the trend line price must pull back to and reclaim.
MinAtrMove 1.5 0.5 4.0 Minimum net displacement over the window, in ATRs (filters out non-trends).
MaxPullbackBars 5 2 15 How many recent bars form the pullback structure used for the stop.
AtrPeriod 14 5 40 ATR period used for volatility measurement and risk sizing.
StopAtrMult 1.4 0.5 3.0 Maximum allowed structural risk as an ATR multiple; wider setups are skipped.
RewardRatio 2.0 1.0 4.0 Take-profit = RewardRatio × the structural stop distance.
BreakevenAtr 1.0 0.3 3.0 Move the stop to breakeven once price advances this many ATRs in favour.
TrailAtr 1.5 0.5 4.0 After breakeven, trail the stop this many ATRs behind price.
Lots 0.10 0.01 1.0 Order volume (position size) per trade.
Trend Purity Pullback MT5 EA — MQL5 source code

Recommended Chart Settings

The Trend Purity Pullback strategy was designed with clean intraday and swing trends in mind, such as those seen on major FX pairs and index CFDs — for example EURUSD, XAUUSD (gold), or US100 — on timeframes from M15 to H4. The system is single-timeframe by design: every calculation uses the chart's own timeframe, so it adapts to whichever period you attach it to rather than hardcoding one.

Because the strategy filters aggressively for trend cleanliness, it will naturally trade less often on noisy, range-bound instruments and more often when a market is producing orderly directional moves. Results will vary considerably across different symbols, brokers, spreads, and market conditions, so treat the recommended settings as a starting point for study and testing rather than a fixed prescription.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every strategy involves trade-offs, and understanding them is part of becoming a more disciplined trader.

Strengths of this approach:

Known limitations:

Study how the strategy behaves across different symbols and timeframes before drawing conclusions, and remember that a backtest reflects the past, not the future.

Risk Management Tips

Sound risk management matters more than any single entry signal. As you study this strategy, keep these general principles in mind:

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