Blog / Strategy
Strategy

Deviation Reset Continuation

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 Deviation Reset Continuation strategy is a trend-continuation system built around a volatility-normalized deviation of price from an EMA (Exponential Moving Average) baseline. An EMA is a moving average that weights recent prices more heavily, giving you a smooth "fair value" line that the market tends to drift around. Rather than trying to catch tops and bottoms, this approach is designed for markets that are already trending and periodically pausing before pushing on in the same direction.

The core gauge behind the strategy is a measurement the code calls the "stretch": the distance between the current close and the EMA baseline, divided by the ATR (Average True Range — a common measure of how much price typically moves per bar). Expressed as stretch = (close − EMA) / ATR, this tells you how many ATRs price is trading away from its own baseline. Because the deviation is divided by ATR, it becomes scale-free, so the same thresholds behave consistently across different symbols, price levels, and timeframes. This is a deliberate guard against overfitting to one particular market.

As a learning tool, this strategy is well suited to traders who want to study how trend-following systems distinguish a healthy pullback from a genuine reversal. Healthy trends rarely move in a straight line — they extend, pull back toward the baseline, then resume. This system does not fade the extension; instead it waits for the stretch to "reset" toward zero and then looks to join the resumption, always in the direction the baseline is already sloping. It is best viewed as a structured example of trend-continuation logic rather than a shortcut of any kind.

How It Works

The strategy runs as a small, non-repainting state machine that only evaluates closed bars — it never acts on an unfinished candle, which avoids the false signals that come from mid-bar noise. The logic moves through three stages before a trade can open:

If the regime flips direction, or MaxWaitBars pass without a resumption, the armed setup is abandoned and the strategy goes back to scanning. This time limit keeps the system from clinging to a stale idea.

For exits and risk, the strategy relies on three mechanisms working together:

The strategy holds exactly one position per magic number — no averaging, no grid, no adding to losers. Position size uses fixed-fractional sizing that scales the base lot with account balance and clamps it to a hard ceiling.

deviation reset continuation MT5 EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
BasisPeriod 34 10 100 Period of the EMA baseline the deviation is measured from.
AtrPeriod 14 7 30 ATR period, used both to normalize the deviation and to size the risk unit.
SlopeLookback 5 2 20 Number of bars over which the baseline slope (the regime) is measured.
PullbackDepth 0.30 -0.50 1.50 Arms the setup once the stretch pulls back to at or below this level (in ATRs).
ResumeLevel 0.60 0.00 2.00 Resumption trigger — the stretch must re-extend beyond this level (in ATRs).
MaxWaitBars 6 2 20 How many bars the strategy keeps waiting for a resumption after arming.
StopAtrMult 2.0 1.0 4.0 Initial stop distance as a multiple of ATR.
RewardRiskRatio 2.0 1.0 5.0 Take-profit as a reward-to-risk multiple of the stop distance.
TrailAtrMult 2.5 1.0 5.0 ATR trailing-stop multiple; ratchets only in the trade's favour.
BaseLots 0.10 0.01 1.00 Fixed-fractional base lot size.
MaxLots 2.00 0.10 10.0 Hard ceiling on position size.
Magic 517033 0 9,999,999 Magic number that tags and isolates this EA's trades.
deviation reset continuation MT5 EA — MQL5 source code

Recommended Chart Settings

The Deviation Reset Continuation strategy was designed with trending FX majors, metals, and indices in mind, on the M30 to H4 timeframes. These timeframes tend to produce cleaner, more persistent trends than very short intraday charts, which suits a continuation approach that waits for a pullback and a fresh push.

That said, nothing about the symbol or timeframe is hardcoded — the ATR normalization means the same thresholds are intended to travel reasonably well across instruments. Because market conditions vary widely, results will differ from one symbol, period, and volatility regime to another. Any timeframe or symbol you consider should be studied on a demo account first so you can see how the arming and resumption logic behaves in that specific context.

How to Install on MetaTrader 5

What to Consider Before Using This EA

Every strategy has conditions it is built for and conditions where it struggles. Understanding both is part of using any tool responsibly.

Strengths of this approach:

Known limitations:

The goal here is education, not persuasion. Study why a signal fires and why some setups are abandoned; that understanding is far more valuable than any single result.

Risk Management Tips

Sound risk management matters more than any individual entry signal. A few widely taught principles:

Risk management is not a feature you switch on once — it is a discipline you apply on every single trade.

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