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 Calm Pullback Trend Rider is a trend-continuation Expert Advisor (EA) that combines a classic dual EMA (Exponential Moving Average) trend filter with an unusual, original twist: a "pullback calmness" gate built on ATR (Average True Range). An EMA is a moving average that weights recent prices more heavily, so it reacts faster to new information than a simple average. ATR is a volatility measure that describes how much price typically travels within a bar. Together these two tools let the strategy define both the direction of a trend and the character of the retracements inside it.
Most pullback systems ask a single question: "how deep did price retrace?" The Calm Pullback Trend Rider asks a different, rarely-used question: "how fast and how violently did price retrace?" The reasoning is that in a genuinely healthy trend, the counter-trend pullback tends to be a slow, orderly drift back toward the mean — quiet, small bars. When a trend is actually running out of steam, the pullback often arrives as a sharp, high-velocity thrust. By measuring the average per-bar travel of the recent leg and comparing it to ATR, the strategy attempts to trade only the calm retracements and stand aside during the choppy ones.
As a learning tool, this EA is well suited to traders who want to study trend-following logic, pullback timing, and volatility-normalized filters. It is designed for trending market conditions on liquid instruments and single-timeframe execution. It is best viewed as a framework for understanding how a "quality of pullback" filter behaves — not as a shortcut to results. Beginners can use it to see how trend context, entry confirmation, and structured risk management fit together in one system.
How It Works
The strategy evaluates its rules once per newly-closed bar, then manages any open position on every tick. Here is the logic in plain English.
Defining the trend (single timeframe, EMA-based):
- Uptrend: the Fast EMA is above the Slow EMA and the Slow EMA is rising (positive slope).
- Downtrend: the Fast EMA is below the Slow EMA and the Slow EMA is falling (negative slope).
- If neither condition holds, the market is treated as directionless and no trades are considered.
The calmness gate:
- The strategy sums the absolute close-to-close move over the last n bars (set by
PullbackBars) and divides by n to get the average per-bar travel. - The leg is considered "calm" when that average is less than or equal to
CalmFactor× ATR. - If the retrace was fast or violent, the signal is discarded — this is what keeps the strategy out of likely reversals.
Long entry — all conditions must hold on the just-closed bar:
- The trend is up.
- A real pullback happened: the lowest low of the last n bars dipped to or below the Fast EMA (price returned to value).
- The leg was calm (passed the ATR-normalized speed test above).
- Reclaim confirmation: the signal bar is bullish (close above open), closes back above the Fast EMA, and closes above the previous bar's close (turning up).
Short entry is the exact mirror image: trend down, the highest high of the recent leg reached or exceeded the Fast EMA, the leg was calm, and the signal bar is bearish, closing below the Fast EMA and below the previous close.
Stop-loss logic:
- For longs, the stop is placed just below the pullback's lowest low, padded by
StopAtrMult× ATR. For shorts, it sits just above the pullback high. Because entries occur right off the mean, this structural stop tends to be tight. - Any trade whose structural risk exceeds
MaxRiskAtr× ATR is skipped entirely, so a single trade can never risk an outsized amount.
Take-profit logic:
- The take-profit is set at
RewardRiskmultiples of the measured risk distance. With the default of 2.0, the target is twice the initial stop distance.
Trade management:
- Once price moves
BreakevenRrisk-multiples into profit, the stop is pulled to break-even and then trailed byTrailAtrMult× ATR. The trail only ever tightens — it is never loosened. - Only one position is held at a time, tagged with the
Magicnumber.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| FastEmaPeriod | 20 | 5 | 60 | Period of the fast EMA used as the entry/value line that price pulls back to. |
| SlowEmaPeriod | 50 | 20 | 200 | Period of the slow EMA that defines the higher-level trend direction and slope. |
| PullbackBars | 3 | 2 | 8 | Number of bars (n) in the recent pullback leg measured for extremes and calmness. |
| CalmFactor | 0.40 | 0.10 | 1.00 | Calmness threshold as a multiple of ATR; lower values demand quieter, slower retraces. |
| AtrPeriod | 14 | 5 | 40 | Lookback period for the ATR used in the calmness gate, stops, and trailing. |
| StopAtrMult | 0.50 | 0.0 | 2.0 | Extra padding (× ATR) placed beyond the pullback extreme for the structural stop. |
| MaxRiskAtr | 3.0 | 1.0 | 8.0 | Trades whose stop distance exceeds this multiple of ATR are skipped. |
| RewardRisk | 2.0 | 1.0 | 5.0 | Take-profit distance as a reward-to-risk multiple of the initial risk. |
| BreakevenR | 1.0 | 0.3 | 2.0 | Profit in risk-multiples (R) required before the break-even lock and trail arm. |
| TrailAtrMult | 1.5 | 0.5 | 4.0 | Trailing stop distance behind price, expressed as a multiple of ATR. |
| Lots | 0.05 | 0.01 | 1.0 | Fixed trade volume in lots for each position. |

Recommended Chart Settings
The Calm Pullback Trend Rider was designed as a single-timeframe system, meaning every calculation uses the chart's own timeframe with nothing hardcoded. Historically, pullback-continuation logic of this type tends to be studied on liquid instruments with clean directional moves — for example major forex pairs or index CFDs — around the M15 to H1 timeframes. These intermediate timeframes offer enough bars to measure a meaningful pullback leg while filtering out much of the noise seen on very fast charts.
That said, no single symbol or timeframe is universally optimal. Trend character, volatility, and spread differ from one market to the next, and results will vary considerably across different market conditions. Treat the M15–H1 range on liquid trends as a reasonable starting point for study, then use a demo account to observe how the calmness gate and trend filter behave on the specific instrument you are researching before drawing any conclusions.
How to Install on MetaTrader 5
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
What to Consider Before Using This EA
Strengths of the approach. The most distinctive feature is the calmness filter. By normalizing pullback speed against ATR, the strategy adapts to changing volatility rather than relying on fixed pip thresholds. This velocity-based screen is an elegant way to distinguish an orderly retrace from a violent one, and it pairs naturally with a slope-confirmed trend filter and a tight structural stop. The built-in risk cap (MaxRiskAtr) and the break-even-then-trail management are sensible design choices that aim to keep individual losses contained.
Known limitations. Like all trend-continuation systems, this strategy depends on the market actually trending. In prolonged ranging or choppy conditions, the EMA trend filter may flip back and forth, and even "calm" pullbacks can resolve against the position. Requiring both a value pullback and a calm leg and a same-bar reclaim makes the entry selective, which can mean long stretches with few or no trades. During sharp, news-driven reversals — precisely when a pullback looks violent — the calmness gate is designed to keep you out, but no filter is perfect and gaps can still occur.
Where it may underperform. Very low-volatility, directionless markets and highly erratic, high-spread instruments are the least favorable environments. Because the strategy trades a single position at a time and skips high-risk setups, it prioritizes selectivity over frequency. Traders expecting constant activity may find the trade count lower than other systems. As always, historical behavior in a backtest may not repeat, and parameters that fit past data can behave very differently going forward.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Consider these general principles as you study this or any EA:
- Risk a small, fixed fraction per trade. Many educational sources suggest never risking more than 1–2% of account equity on a single position. Adjust the
Lotsinput and your account size so that a full stop-out stays within that limit. - Test on a demo account first. Run the strategy in a risk-free simulated environment for an extended period before considering any live capital. This lets you observe drawdown, trade frequency, and behavior across different regimes.
- Understand drawdown. Even a well-designed system experiences losing streaks. Know the maximum peak-to-trough decline you are willing to tolerate, and stop to reassess if it is exceeded.
- Do not over-optimize. Tuning parameters until they perfectly fit past data ("curve fitting") often produces fragile results. Prefer robust settings that work reasonably across a range of conditions.
- Mind costs and leverage. Spreads, commissions, slippage, and leverage all affect real outcomes and are easy to underestimate in testing.
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
- Expert Advisor: CalmPullbackTrendRider.ex5 (24 downloads)
- Source Code: CalmPullbackTrendRider.mq5 (25 downloads)
- Documentation: CalmPullbackTrendRider.pdf (28 downloads)