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 Broken Leg Trap Reversal is a trend-continuation strategy built around fractal swing detection and an Exponential Moving Average (EMA) trend filter. An EMA is a moving average that gives more weight to recent prices, so it reacts faster to changes in direction than a simple average. The strategy watches for a specific "trap" pattern: during an established trend, price pushes past the last protective swing point — the kind of level where many stop-loss orders sit — and then quickly reverses back to the trend side. That failed break is the signal.
In plain terms, trends tend to move in "legs" separated by swing pivots (small peaks and troughs). Sometimes a corrective pullback dips just far enough to pierce the previous swing, triggering stop orders and tempting counter-trend traders to bet on a reversal. When price then reclaims that broken level within a few bars, those counter-trend traders are trapped on the wrong side. The Broken Leg Trap Reversal is designed to identify that reclaim and join the dominant trend as it resumes. It uses the Average True Range (ATR) — a volatility measure — to place its protective stop beyond the trap extreme.
This strategy is best suited as a learning tool for traders who want to study how trend-following systems combine structure (swing pivots), a directional filter (EMA slope), and volatility-based risk placement (ATR). It is an analytical framework for understanding failed-breakout logic, not a shortcut to results. Because it only trades in the direction of the prevailing trend, it may appeal to those studying momentum and continuation setups rather than pure reversals.
How It Works
The strategy makes one decision per newly closed bar on a single primary timeframe. It continuously tracks the most recent confirmed swing high and swing low using a fractal method, then looks for a break-and-reclaim sequence in the direction of the trend.
- Trend filter: The strategy signals an uptrend only when the closing price is above the EMA and the EMA is sloping upward (its current value is higher than its previous value). A downtrend requires the close below the EMA with the EMA sloping downward.
- Swing detection: A fractal pivot is confirmed when a bar's low is the lowest (for a swing low) or its high is the highest (for a swing high) compared to an equal number of bars on each side, defined by
SwingLookback. - Long "broken leg": In a confirmed uptrend, if a bar's low pierces below the last swing low and still closes below it, the strategy arms a long trap. It records the trap's lowest point and the broken level, and will not re-arm on that same swing.
- Long reclaim (entry): While the trap is active, if a later bar closes back above the broken swing level within the
ReclaimBarswindow, the bull trap is considered sprung and the strategy signals a long entry to rejoin the uptrend. - Short "broken leg": In a confirmed downtrend, the mirror image applies — a bar pierces above the last swing high and closes above it, arming a short trap.
- Short reclaim (entry): If a later bar closes back below the broken level within the reclaim window, the strategy signals a short entry to rejoin the downtrend.
- Reclaim window expiry: If price does not reclaim the level within
ReclaimBarsbars, the trap is discarded as a genuine breakout rather than a trap, and no trade is taken. - Stop-loss logic: For a long, the stop is parked below the lowest point of the trap, minus a multiple of ATR (
AtrSlMult). For a short, it sits above the trap's highest point plus that same ATR multiple. This places the stop beyond the extreme that "sprung" the trap. - Take-profit logic: The distance from entry to stop defines the risk (one "R"). The take-profit is set at a reward multiple of that risk (
RewardMult). With the default of 2.0, the target is twice the distance of the stop. - One position at a time: The strategy will not open a new trade if a position with its magic number is already open on the symbol.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| SwingLookback | 3 | 2 | 8 | Number of bars on each side of a pivot required to confirm a fractal swing high or low. Larger values find more significant swings less often. |
| TrendEmaPeriod | 50 | 20 | 200 | Period of the EMA used as the trend filter. Higher values react more slowly and define a longer-term trend. |
| ReclaimBars | 3 | 1 | 6 | Maximum number of bars allowed for price to reclaim the broken level before the trap is discarded as a genuine breakout. |
| AtrPeriod | 14 | 7 | 30 | Lookback period for the ATR volatility measure used to size the stop distance. |
| AtrSlMult | 1.0 | 0.3 | 3.0 | Multiple of ATR added beyond the trap extreme when placing the stop-loss. Larger values give the trade more room. |
| RewardMult | 2.0 | 0.5 | 5.0 | Take-profit distance expressed as an R-multiple of the measured risk (entry-to-stop distance). |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots. Should be adjusted to your account size and risk tolerance. |

Recommended Chart Settings
The Broken Leg Trap Reversal was designed to run on a single primary timeframe, making a decision once per closed bar. Intraday timeframes such as the 15-minute (M15) or 1-hour (H1) charts on liquid major forex pairs — for example EUR/USD or GBP/USD — are reasonable starting points for study, because these markets tend to produce the clean trends and stop-run behavior the strategy looks for. That said, the defaults are only a baseline. Swing significance, trend strength, and volatility differ markedly across symbols and sessions, so results will vary across different market conditions. Always test any combination of symbol and timeframe thoroughly before drawing 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
The strength of the Broken Leg Trap Reversal is its structure. By requiring an aligned EMA-slope trend, a genuine break of a confirmed swing, and a timely reclaim, it filters out many random signals and only acts on a fairly specific sequence of events. Its stops are anchored to real market structure and adjusted for current volatility via ATR, which is a more principled approach than a fixed pip stop. The R-multiple take-profit also enforces a defined risk-to-reward relationship on every trade.
There are important limitations to understand. Trend-continuation systems historically struggle in ranging or choppy markets, where the EMA slope flips frequently and "traps" may simply be noise. Because the strategy requires a break and a reclaim within a limited window, it can miss moves that resume too slowly, and it can be whipsawed when a break that looked like a trap turns into a real breakdown. The single-position rule means only one setup is traded at a time, so overlapping opportunities are skipped. Signal frequency depends heavily on the SwingLookback and ReclaimBars settings — tight values generate more, lower-quality signals, while loose values may indicate very few trades. Like all rule-based systems, it has no discretion around news events or shifting volatility regimes. Treat it as a framework to study and stress-test, not a finished solution.
Risk Management Tips
Sound risk management matters more than any single entry rule. As a general educational guideline, many traders aim to risk no more than 1–2% of account equity on any single trade, and size their position accordingly rather than using a fixed lot size blindly. Before considering live use, run the strategy on a demo account to understand how it behaves through different market conditions, including losing streaks. Study the maximum drawdown — the largest peak-to-trough decline in equity — so you know what a realistic bad run looks like and can decide whether you could tolerate it. Keep a trading journal, review why each signal did or did not work, and never add capital you cannot afford to lose. Automation does not remove risk; it only executes your rules consistently, including through the losses.
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: BrokenLegTrapReversal.ex5 (2 downloads)
- Source Code: BrokenLegTrapReversal.mq5 (0 downloads)
- Documentation: BrokenLegTrapReversal.pdf (0 downloads)