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 Atr Envelope Reclaim is a trend-aligned, pullback-continuation strategy built around a volatility envelope — a pair of bands drawn a fixed number of Average True Range (ATR) units above and below a trend-defining Exponential Moving Average (EMA). ATR is a classic volatility gauge that measures the typical size of a bar's range, while an EMA is a moving average that weights recent prices more heavily so it reacts faster to a developing trend. By combining the two, this strategy tries to spot the moment when price briefly over-extends against an active trend and then snaps back — a behaviour that traders often call a "reclaim."
The trading style here is trend-following with a mean-reversion entry trigger. Rather than trying to call tops and bottoms, the Atr Envelope Reclaim only looks for setups in the direction the EMA is already sloping. In a confirmed uptrend, it waits for a shallow dip that wicks down into the lower envelope and then closes back above it on a bullish candle. In a confirmed downtrend, it waits for a spike into the upper envelope that closes back below it on a bearish candle. A Relative Strength Index (RSI) filter — a momentum oscillator that ranges from 0 to 100 — is layered on top to avoid chasing moves that already look stretched.
As a learning tool, this strategy is well suited to intermediate traders who want to study how volatility bands, trend filters, and momentum guards can be combined into a single rules-based system. It is framed here as a strategy analysis: a way to understand how a disciplined "buy the dip in an uptrend" logic can be expressed in code, not as a shortcut to any particular outcome.
How It Works
The Atr Envelope Reclaim evaluates its rules once per completed bar and holds at most one position at a time, letting the stop-loss and take-profit manage the exit. Here is what the strategy checks, step by step:
Building the envelope and trend context
- It calculates a trend EMA over the
EmaPeriodsetting and an ATR over theAtrPeriodsetting. - It builds a lower band at
EMA − (EnvMult × ATR)and an upper band atEMA + (EnvMult × ATR). - It measures the EMA's slope by comparing the current EMA to its value
SlopeLookbackbars ago.
Long (buy) entry — the strategy signals a long when all of these are true:
- The trend is up: the EMA is rising and the current close is above the EMA.
- The current bar's low touched or dipped to/under the lower envelope (
low ≤ lower band). - The bar closed back above the lower envelope (
close > lower band) — the "reclaim." - The candle is bullish (close above open), confirming buyers pushed back in.
- RSI is below
50 + RsiBand, meaning momentum is not yet stretched to the upside (a chase guard).
Short (sell) entry — the strategy signals a short when all of these are true:
- The trend is down: the EMA is falling and the current close is below the EMA.
- The current bar's high touched or exceeded the upper envelope (
high ≥ upper band). - The bar closed back below the upper envelope (
close < upper band). - The candle is bearish (close below open).
- RSI is above
50 − RsiBand, meaning momentum is not yet stretched to the downside.
Stop-loss logic
- For a long, the stop is placed at
entry − (SlAtrMult × ATR). - For a short, the stop is placed at
entry + (SlAtrMult × ATR). - Because the stop distance scales with ATR, it automatically widens in volatile conditions and tightens in calm ones.
Take-profit logic
- For a long, the target is
entry + (TpAtrMult × ATR); for a short,entry − (TpAtrMult × ATR). - With the default
SlAtrMultof 1.5 andTpAtrMultof 3.0, the strategy aims for a reward-to-risk ratio of roughly 2:1 on each trade.
Once a position is open, no new trade is taken for that magic number until the existing one closes at its stop or target. This keeps the logic simple and prevents stacking multiple positions on the same signal.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| EmaPeriod | 34 | 10 | 120 | Period of the trend EMA that defines direction and the envelope centre. |
| AtrPeriod | 14 | 5 | 40 | Period of the ATR used to size the envelope width and the SL/TP distances. |
| EnvMult | 2.0 | 0.5 | 4.0 | Envelope multiplier — how many ATRs the bands sit from the EMA. |
| SlopeLookback | 5 | 1 | 30 | Number of bars back used to measure whether the EMA is rising or falling. |
| RsiPeriod | 14 | 5 | 40 | Period of the RSI momentum filter. |
| RsiBand | 15.0 | 0.0 | 40.0 | Width of the RSI band around 50 that guards against chasing stretched moves. |
| SlAtrMult | 1.5 | 0.5 | 5.0 | Stop-loss distance as a multiple of ATR. |
| TpAtrMult | 3.0 | 0.5 | 8.0 | Take-profit distance as a multiple of ATR. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots. |

Recommended Chart Settings
The Atr Envelope Reclaim is designed as a general-purpose intraday-to-swing framework and works most naturally on liquid instruments with clean, trending behaviour — for example major forex pairs such as EUR/USD or GBP/USD. A common starting point is the H1 (1-hour) timeframe, which gives the EMA and envelope enough room to develop a trend while still producing a reasonable number of reclaim setups. Higher timeframes such as H4 tend to yield fewer but broader signals.
The default parameters (34-period EMA, 14-period ATR, 2.0× envelope) are a balanced baseline rather than an optimised configuration. Keep in mind that results will vary considerably across different symbols, timeframes, and market conditions — a setting that suits a trending currency pair may behave very differently on a range-bound or highly volatile instrument. Always study the strategy's behaviour on your specific chart 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
Like any rules-based system, the Atr Envelope Reclaim has clear strengths and equally clear limitations worth understanding.
Strengths of this approach
- Trend alignment. By only trading with the EMA slope, the strategy avoids the common mistake of fading a live trend, which can lead to repeated losses when momentum is strong.
- Volatility-adaptive sizing. Because both the envelope and the stop/target scale with ATR, the strategy automatically adjusts to changing volatility instead of using fixed pip distances.
- A built-in chase guard. The RSI band keeps the strategy from entering when momentum is already stretched, which historically helps filter out lower-quality continuation entries.
Known limitations
- Whipsaw in ranges. Envelope and EMA systems are most vulnerable in sideways, choppy markets where the "trend" flips direction frequently and reclaim signals fail to follow through.
- Reliance on a clean reclaim. The setup needs price to wick into the far band and close back inside on the same bar. In fast, one-directional moves this pattern may simply not appear, so signals can be sparse.
- Fixed lot sizing. The default uses a constant lot size, which does not scale risk to account equity. This is something to review carefully before any live use.
- Single-position design. Only one trade runs at a time per magic number, so the strategy may sit out additional opportunities while a position is open.
The strategy is best viewed as an educational template that demonstrates a coherent continuation logic — not a finished, market-ready product. Its performance depends heavily on the instrument, timeframe, and parameter choices you test it against.
Risk Management Tips
Sound risk management matters more than any single entry rule. As you study this strategy, keep these general principles in mind:
- Risk a small, fixed percentage per trade. Many educational resources suggest limiting exposure to no more than 1–2% of account equity on any single position, so that a string of losers does not do lasting damage.
- Size positions deliberately. The default fixed lot size should be reviewed against your account balance and the ATR-based stop distance, rather than accepted blindly.
- Test on a demo account first. Run the strategy on a demo or paper account across many market conditions before considering anything else, so you can observe its drawdowns without financial exposure.
- Understand drawdown. Every strategy experiences losing streaks. Knowing the historical depth and duration of drawdowns helps you set realistic expectations and avoid abandoning a plan at the worst moment.
- Keep a trading journal. Recording why each signal appeared and how it resolved turns the strategy into a genuine learning exercise.
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: AtrEnvelopeReclaim.ex5 (4 downloads)
- Source Code: AtrEnvelopeReclaim.mq5 (4 downloads)
- Documentation: AtrEnvelopeReclaim.pdf (4 downloads)