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 Efficiency Gated Breakout is a Donchian-style channel breakout strategy built around the Kaufman Efficiency Ratio (ER) — a filter that measures how "clean" a price move is by comparing the net distance travelled to the total path walked to get there. A reading near 1 means the market is moving in a near-straight line (a strong trend), while a reading near 0 means price is churning sideways and covering a lot of ground without going anywhere. By gating every breakout behind this ratio, the strategy tries to trade only when the market is genuinely trending, rather than reacting to the false breaks that dominate range-bound conditions.
At its core, this is a trend-following breakout system. When price closes beyond the highest high or lowest low of the prior N bars — the classic Donchian channel breakout — the strategy checks a stack of confirmation filters before it acts. An Exponential Moving Average (EMA), a smoothed trend baseline, must agree with the breakout direction. The Relative Strength Index (RSI), a momentum oscillator scaled 0–100, must not already be over-extended. And the Average True Range (ATR), a volatility measure, sizes the stop-loss, take-profit, and breakeven trigger so that risk scales with current market conditions.
This makes the Efficiency Gated Breakout a useful learning tool for traders who want to understand how multiple filters can be layered to reduce noise in a breakout system. It is well suited to studying trending markets and regime detection, and to seeing how a single volatility measure can drive an entire trade-management framework. It operates on a single timeframe and acts only on closed bars, which keeps its logic transparent and easy to reason about. It is not a shortcut to trading success — it is a structured example of disciplined, rules-based analysis.
How It Works
The strategy evaluates its rules once per completed bar, using only fully-formed (closed) candle data. Here is what happens on each new bar:
- Regime gate first. The strategy computes the Kaufman Efficiency Ratio over the last
ErPeriodbars. If ER is belowErThreshold, the market is judged too choppy and no new trade is considered at all — the breakout logic is skipped entirely. - Donchian channel check. It then measures the highest high and lowest low over the prior
BreakoutPeriodbars, deliberately excluding the just-closed bar so the breakout level is set by history rather than by the signal candle itself. - Long signal. The strategy signals a potential long when the last close pushes above the prior highest high, sits above the EMA trend baseline, and RSI is below the
RsiCap(so momentum has not already spiked to an extreme). - Short signal. The mirror applies: a potential short is signalled when the last close drops below the prior lowest low, sits below the EMA, and RSI is below the mirrored cap (100 −
RsiCap). - One position at a time. The strategy holds only a single position per magic number — it will not stack or pyramid trades.
Once a trade is opened, exits and risk are handled entirely by ATR-based levels:
- Stop-loss. Placed
SlAtrMult × ATRaway from entry — below the entry for longs, above for shorts. - Take-profit. Placed
TpAtrMult × ATRaway from entry in the direction of the trade. - Automatic breakeven. Once price moves
BeAtrMult × ATRin the trade's favour, the stop-loss is pulled up (or down) to the entry price. This may help protect an open trade from turning into a loss after it has already run in the intended direction, though it does not guarantee any outcome.
Because the stop, target, and breakeven are all derived from ATR, the strategy adapts its risk footprint to volatility: wider stops in fast markets, tighter stops in calm ones.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| ErPeriod | 10 | 5 | 30 | Lookback length for the Kaufman Efficiency Ratio. Shorter reacts faster; longer smooths the regime read. |
| ErThreshold | 0.35 | 0.20 | 0.60 | Minimum ER required to allow a breakout. Higher values demand a cleaner trend before trading. |
| BreakoutPeriod | 20 | 10 | 60 | Number of prior bars used for the Donchian high/low channel that defines the breakout level. |
| TrendPeriod | 50 | 20 | 200 | EMA period for the trend baseline the breakout must agree with. |
| RsiPeriod | 14 | 7 | 21 | Lookback for the RSI momentum filter. |
| RsiCap | 72 | 60 | 85 | Upper RSI limit for longs (mirrored for shorts) to avoid chasing an over-extended move. |
| AtrPeriod | 14 | 7 | 21 | Lookback for the ATR volatility measure that drives stops and targets. |
| SlAtrMult | 1.5 | 0.5 | 3.0 | Stop-loss distance as a multiple of ATR. |
| TpAtrMult | 3.0 | 1.0 | 6.0 | Take-profit distance as a multiple of ATR. |
| BeAtrMult | 1.0 | 0.5 | 3.0 | How far price must move in favour (in ATR multiples) before the stop is moved to breakeven. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed order volume, in lots, for each trade. |

Recommended Chart Settings
The Efficiency Gated Breakout is a single-timeframe system, so it should be attached to one chart and left to evaluate that timeframe's closed bars. Breakout strategies of this type are commonly studied on the H1 (1-hour) or H4 (4-hour) timeframes of liquid instruments such as major forex pairs (for example EUR/USD or GBP/USD) or gold (XAU/USD), where trends can develop with enough room for an ATR-based target to be reached.
The defaults — a 20-bar Donchian channel, a 50-period EMA, and a 10-bar Efficiency Ratio — are a reasonable starting point for this kind of intraday-to-swing horizon. That said, no single setting is optimal everywhere. The parameter ranges are provided precisely so you can study how the strategy behaves as you adjust them, and results will vary considerably across different instruments, timeframes, and market conditions. Test any configuration thoroughly before drawing conclusions.
How to Install on MetaTrader 5
- Download the
EfficiencyGatedBreakout.ex5file from the link below. - Copy it to your MT5
MQL5\Expertsfolder. - Restart MetaTrader 5 or right-click the Navigator panel and choose Refresh.
- 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
Every strategy has a personality, and understanding this one's strengths and weaknesses is the whole point of studying it.
Strengths. The Efficiency Ratio gate is the standout feature: by filtering for efficient, one-directional movement, the strategy is designed to sidestep many of the whipsaw losses that plague naive breakout systems in sideways markets. Layering the EMA trend filter and the RSI over-extension cap adds two more independent checks, so a signal has to clear several hurdles before a trade is placed. ATR-based stops and targets mean risk automatically scales with volatility, and the automatic breakeven adds a layer of trade management that many simple systems lack.
Known limitations. Breakout systems inherently give back some profit at trend turns and can suffer clusters of small losses during choppy, transitional phases — and while the ER gate reduces this, it does not eliminate it. Because the strategy requires a confirmed trending regime plus EMA agreement plus an acceptable RSI reading, it is selective and may sit out for long stretches, which can test a trader's patience. Multiple filters also mean multiple parameters, which raises the risk of curve-fitting — tuning the inputs so tightly to past data that they fail on new data. A fixed lot size does not adapt position risk to account balance. And, like all breakout strategies, it can underperform in low-volatility, mean-reverting markets where price repeatedly pokes past a channel and snaps back.
The honest takeaway: this is a well-structured educational example of a filtered breakout, not a finished trading solution. Its value is in what it teaches about combining regime, trend, momentum, and volatility filters.
Risk Management Tips
Sound risk management matters more than any single entry rule. As you study this or any strategy, keep these principles in mind:
- Risk a small, fixed fraction per trade. Many educators suggest never risking more than 1–2% of account equity on a single position. Because this EA uses a fixed lot size, you may need to adjust
Lotsto match your account and the ATR-based stop distance. - Understand your drawdown. Even a sound strategy will experience losing streaks. Know how many consecutive losses you could tolerate — financially and psychologically — before you commit real capital.
- Start on a demo account. Run the EA on a demo or simulated account first to observe how it behaves across different market conditions without risking money.
- Size positions deliberately. Match your lot size to your account balance, the instrument's volatility, and your personal risk tolerance rather than using a default blindly.
- Never trade money you cannot afford to lose, and treat every backtest as a hypothesis to be tested, not a promise.
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: EfficiencyGatedBreakout.ex5 (1 downloads)
- Source Code: EfficiencyGatedBreakout.mq5 (1 downloads)
- Documentation: EfficiencyGatedBreakout.pdf (2 downloads)