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 Three Bar Reversal is a pure price-action swing reversal strategy that reads a classic 1-2-3 candlestick pattern at a fresh range extreme, filtered by the Average True Range (ATR) — a volatility indicator that measures how far price typically moves over a set number of bars. Unlike systems built on moving averages or oscillators, this approach takes no signal from smoothed indicators at all. Three consecutive raw candles form the entire setup, and ATR is used only to gauge whether the confirmation bar carried real momentum. In trading terms, this is a counter-trend swing reversal with a mean-reversion flavour: it looks to enter just as an exhausted push snaps back on itself.
The pattern is designed for moments when the market sweeps a recent high or low — often a stop-run that briefly pushes price beyond support or resistance to trigger resting orders — and then rejects that new extreme by closing firmly back inside the prior range. That behaviour tends to show up around liquid instruments with clean swing structure. The strategy was tuned with XAU/USD (gold) and GBP/USD on the M15 to H1 timeframes in mind, though the code reads only the chart's own symbol and timeframe, so it can be studied on any liquid market you attach it to.
As a learning tool, the Three Bar Reversal suits traders who want to understand how a liquidity sweep and a confirmation close combine to define a structural reversal. It is best framed as a strategy analysis for study rather than a shortcut of any kind. Because it is counter-trend by nature, it rewards patience and a strict definition of "confirmed," and it offers a clear, readable example of how a few well-chosen rules can filter noisy single-wick fakeouts out of a signal.
How It Works
The strategy processes one signal per freshly closed bar and holds only one position at a time. It labels the three most recently closed candles — candle 1 (three bars back), candle 2 (two bars back, the sweep), and candle 3 (the just-closed confirmation bar) — and checks them against the surrounding swing structure.
Long (bullish) entry — the strategy signals a long when all of the following are true:
- Candle 2 sweeps the swing low: its low is the lowest low across the lookback window that ends at candle 2, meaning price undercut recent support.
- Candle 2 undercuts candle 1: its low prints below candle 1's low, confirming a genuine capitulation move rather than a sideways drift.
- Candle 3 is bullish: it closes above its open.
- Candle 3 closes above candle 2's entire high: the market rejected the new low and snapped the range shut — this close-through is the confirmation.
- Momentum filter passes: candle 3's body (open-to-close distance) is at least
MinBodyAtr × ATR, so a limp, indecisive bar does not qualify.
Short (bearish) entry is the exact mirror at a fresh swing high: candle 2 prints the window's highest high and exceeds candle 1, candle 3 is bearish and closes below candle 2's entire low, and the same ATR body filter must pass.
Stop-loss logic:
- For longs, the stop is placed just below the swept extreme:
SL = candle 2 low − (SlAtrMult × ATR). The ATR padding gives the trade room beyond the exact wick that swept liquidity. - For shorts, the stop mirrors above:
SL = candle 2 high + (SlAtrMult × ATR).
Take-profit logic:
- Risk is measured as the distance from entry to stop. The target is set at a fixed multiple of that risk:
TP = entry ± (RiskReward × risk). With the defaultRiskRewardof 2.0, the target sits twice as far from entry as the stop. - If the calculated risk is zero or negative, the strategy skips the trade rather than sending an invalid order.
Because both stop and target are defined the moment the position opens, each trade carries a fixed, pre-planned risk/reward profile with no discretionary management after entry.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| Lots | 0.10 | 0.01 | 1.00 | Fixed trade volume (position size) sent with every order. |
| SwingLookback | 12 | 5 | 40 | Number of bars in the swing window (ending at candle 2) used to define the extreme that must be swept. |
| AtrPeriod | 14 | 7 | 30 | Number of bars used to calculate ATR, the volatility measure behind the momentum filter and stop padding. |
| MinBodyAtr | 0.25 | 0.00 | 1.50 | Minimum size of candle 3's body, expressed as a multiple of ATR — the momentum filter on the confirmation bar. |
| SlAtrMult | 0.40 | 0.00 | 2.00 | Extra stop-loss padding placed beyond the swept extreme, as a multiple of ATR. |
| RiskReward | 2.0 | 1.0 | 5.0 | Reward-to-risk ratio that sets the take-profit distance relative to the stop distance. |

Recommended Chart Settings
This strategy was tuned with XAU/USD (gold) and GBP/USD in mind, on timeframes from M15 through H1. These instruments tend to produce the clean swing highs and lows, plus the periodic liquidity sweeps, that the 1-2-3 pattern is built to read. That said, the code reads only the chart's own symbol and timeframe, so you can study it on any liquid market you attach it to.
Keep in mind that results will vary considerably across different symbols, timeframes, and market conditions. A parameter set that behaves well on gold during a volatile session may behave very differently on a quieter pair or in a trending regime. Treat the recommended settings as a starting point for study and testing, not a fixed prescription.
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 main strength of the Three Bar Reversal is its clarity. Every condition is defined on raw candles, so there is no lag from smoothed indicators and no ambiguity about whether a signal fired. The requirement that candle 3 close through candle 2's entire range — combined with the ATR body filter — is deliberately strict, which historically helps cut single-wick fakeouts that would trip a looser reversal rule. The structural stop beyond the swept extreme and the fixed risk/reward target also make each trade's risk profile transparent before entry.
The limitations are equally important to understand. As a counter-trend method, the strategy is trading against the immediate momentum, which means it can be repeatedly stopped out during strong, persistent trends where price sweeps a level and simply keeps going. Its selectivity also means signals may be infrequent, so it can sit idle for long stretches. Because entries hinge on a specific three-bar shape, choppy or low-volatility conditions may produce few qualifying setups, while news-driven spikes can create sweeps that do not resolve the way the pattern assumes. Finally, the fixed take-profit means the strategy does not adapt to extended moves — a winner is capped at the RiskReward multiple regardless of how far price might have travelled. None of these traits make the approach good or bad; they simply define the conditions under which it may indicate strong setups versus the conditions where it may underperform.
Risk Management Tips
Sound risk management matters more than any single entry rule. Consider these general principles as you study any strategy:
- Size positions to your account, not to the default. The
Lotsvalue is a fixed volume; align it with your own capital and risk tolerance rather than accepting the default blindly. - Risk only a small fraction per trade. Many educational sources suggest never risking more than 1–2% of account equity on a single position, so that a string of losses does not do lasting damage.
- Test on a demo account first. Run the strategy in a risk-free simulated environment long enough to understand its behaviour, trade frequency, and drawdown before considering any live capital.
- Understand drawdown. Even a well-designed counter-trend system will have losing streaks. Know how large a peak-to-trough decline you can tolerate emotionally and financially.
- Keep records and review. Logging your tests helps you see whether the strategy's behaviour matches your expectations across different market conditions.
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: ThreeBarReversal.ex5 (4 downloads)
- Source Code: ThreeBarReversal.mq5 (4 downloads)
- Documentation: ThreeBarReversal.pdf (3 downloads)