Blog / Strategy
Strategy

Percent Range Trend 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 Percent Range Trend Pullback strategy is a trend-following pullback system built around the Williams Percent Range (%R) oscillator, a momentum indicator that measures where the current price sits inside its recent high-to-low trading range. Rather than trying to predict tops and bottoms, this approach waits for an established trend and then looks to enter on temporary dips (in an uptrend) or temporary rallies (in a downtrend). It is a classic "buy strength on weakness" style of trading, packaged as an Expert Advisor (EA) for MetaTrader 5.

Direction is defined by a slope-filtered Exponential Moving Average (EMA) — a moving average that weights recent prices more heavily and reacts faster than a simple average. The strategy only considers long trades when the EMA is both above price and actually rising, and short trades only when the EMA is below price and actually falling. Timing is then handed to the Williams %R oscillator, which identifies when a pullback appears to be ending and the trend may be resuming. Both the trend filter and the %R trigger must agree on the same closed bar before any order is placed.

This EA is best understood as a learning tool for traders who want to study how a disciplined, rules-based pullback system is constructed. It demonstrates how a direction filter, a timing oscillator, and ATR-based (Average True Range) risk management can be combined into a single, self-scaling framework. It is designed for trending markets and is not a counter-trend or scalping system. As with any strategy, its behaviour will vary considerably across different symbols, timeframes, and market conditions.

How It Works

The strategy evaluates its rules once per closed bar — it does not react to every tick, which helps avoid noise from unfinished candles. On each newly-closed bar it checks the trend, the oscillator, and the risk levels before acting.

Trend filter (both conditions required):

Entry trigger (a %R crossover with a candle confirmation):

Stop-loss logic:

Take-profit logic:

Trade management:

percent range trend pullback EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
TrendEmaPeriod 50 20 200 Length of the trend EMA — the backbone that defines direction.
EmaSlopeLookback 3 1 10 How many bars back the EMA slope is measured over; the EMA must be rising/falling to trade.
WprPeriod 14 7 40 Lookback period for the Williams %R oscillator.
PullbackDepth 20.0 10.0 35.0 Pullback depth: oversold line = −(100 − depth), overbought line = −depth.
AtrPeriod 14 7 28 ATR period used for stop, target, and trail sizing.
StopAtrMult 1.5 0.5 4.0 Initial stop distance as a multiple of ATR beyond entry.
RewardRatio 1.8 0.8 4.0 Take-profit distance as a multiple of the stop distance (reward : risk).
TrailAtrMult 2.0 0.5 5.0 ATR trailing-stop distance once the trade is in profit (ratchets only in your favour).
MaxSpreadPoints 30 1 200 Skip entries when the current spread (in points) is wider than this.
Lots 0.10 0.01 1.00 Order volume (position size in lots).
Magic 4821 0 9,999,999 Unique identifier so the EA only manages its own trades.
percent range trend pullback EA — MQL5 source code

Recommended Chart Settings

This strategy was designed with trending instruments in mind — a trending major currency pair such as EURUSD or GBPUSD, or an index — on the M15 to H1 timeframes. That combination suits its trend-following, swing-style character: it aims to sit through pullback-and-resume cycles rather than scalp small intrabar moves.

Because the stop, target, and trailing distances are all derived from ATR, the framework adapts its risk sizing to the volatility of whatever symbol and timeframe you choose. That said, no single set of defaults is optimal everywhere. Trending pairs behave very differently from range-bound ones, and the same parameters can perform very differently across market conditions. Treat the recommended settings as a starting point for study and testing, not a fixed prescription, and always validate on historical data and a demo account before considering anything else.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every strategy has trade-offs, and understanding them is part of using any tool responsibly.

Strengths of this approach:

Known limitations:

The strategy tends to perform best when markets are trending cleanly and worst during extended consolidation. It is not a "set and forget" solution, and it should be studied, tested, and monitored rather than trusted blindly.

Risk Management Tips

Sound risk management matters far more than any single entry rule. Consider these general principles as you study this or any 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