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 Advance Block Reversal strategy is a pure price-action, counter-trend exhaustion system built around the classic three-candle advance block pattern — a well-known Japanese candlestick formation that signals waning momentum at the end of a directional run. In candlestick analysis, an advance block appears when price keeps pushing in the same direction across three consecutive candles that each close further into the move, yet the "real bodies" (the distance between open and close) are visibly shrinking while the rejection wick on the far side keeps growing. Higher (or lower) closes, but with weaker and weaker conviction: the drive is running out of fuel.
Because a raw candlestick pattern can print anywhere — including inside meaningless chop — this strategy adds a critical context filter using the Average True Range (ATR), a standard measure of market volatility, and a Simple Moving Average (SMA) baseline of recent closing prices. The strategy only acts when the newest candle is stretched far away from that moving-average baseline, meaning the market is overextended and statistically primed to snap back toward its mean. When a decelerating advance block prints at an overextended extreme, the strategy fades it — trading against the immediate run in anticipation of a mean-reversion move.
This is a mean-reversion / exhaustion trading style, and it is best understood as a learning tool for traders who want to study how candlestick geometry, volatility filters, and moving-average context can be combined into a single rules-based system. It is not a shortcut to results — it is a transparent, fully-coded example of how discretionary "the run looks tired" reasoning can be translated into objective, testable conditions. Notably, the baseline SMA and the ATR are both computed directly from raw bar data inside the code, so the logic has no hidden dependency on external indicator libraries.
How It Works
The strategy evaluates the market once per newly-closed candle and only ever holds one position at a time. It examines the three most recently closed candles — labelled c1 (newest), c2 (middle), and c3 (oldest of the block) — plus a rolling baseline and a volatility reading.
Short setup (bearish advance block ending an overextended up-drive):
- The strategy signals a potential short when the three candles are all bullish (each closes above its open).
- The closes must be successively higher (c1 close > c2 close > c3 close) — price is still advancing.
- The real bodies must be decelerating: body3 ≥ body2 ≥ body1, with a genuine net shrink (body1 < body3). Momentum is fading even as price climbs.
- The newest candle must show an upper-wick rejection: its upper wick is at least
WickBodyRatiotimes the size of its own body, and the upper wicks are growing across the block. Counter-pressure is building at the highs. - The newest close must be stretched above the baseline by at least
StretchAtrMult× ATR — confirming the market is overextended, not merely drifting. - When all conditions align, the strategy sends a SELL order.
Long setup (bullish decline block ending an overextended down-drive): this is the exact mirror image — three bearish candles making successively lower closes, decelerating bodies, a growing lower-wick rejection on the newest candle, and a close stretched below the baseline by the required ATR multiple. When these align, the strategy sends a BUY order.
Exit logic (stop-loss and take-profit):
- On a short, the stop-loss is placed at entry +
AtrSlMult× ATR (above the market), and the take-profit at entry −AtrTpMult× ATR (below the market, toward the mean). - On a long, the stops and targets are mirrored: stop-loss below entry, take-profit above.
- Both exits are volatility-scaled by ATR, so the risk and reward distances automatically widen in fast markets and tighten in quiet ones. There is no separate trailing or time-based exit — the fixed SL/TP bracket manages the trade to completion before a new signal can be taken.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| BaselinePeriod | 20 | 8 | 60 | Number of closed bars used for the SMA baseline that defines the "mean" price the market is measured against. |
| AtrPeriod | 14 | 5 | 40 | Lookback length for the Average True Range volatility calculation used in the stretch filter and stop/target sizing. |
| StretchAtrMult | 1.5 | 0.3 | 4.0 | How many ATRs the newest close must sit away from the baseline before a block qualifies as "overextended." |
| WickBodyRatio | 0.6 | 0.1 | 2.5 | Minimum size of the rejection wick relative to the newest candle's real body, confirming counter-pressure. |
| AtrSlMult | 1.6 | 0.5 | 5.0 | Stop-loss distance as a multiple of ATR. |
| AtrTpMult | 2.4 | 0.5 | 8.0 | Take-profit distance as a multiple of ATR. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed order volume (position size) in lots. |

Recommended Chart Settings
The Advance Block Reversal EA was designed with XAU/USD (gold) or GBP/JPY on the M15 or M30 timeframes in mind — markets and timeframes where sharp directional pushes are common and mean-reversion snaps are frequent enough to give the pattern context. However, the code is locked to no specific symbol or timeframe: it runs on whatever primary symbol and timeframe the chart is set to, so you are free to study its behaviour on other instruments.
Keep in mind that mean-reversion logic behaves very differently across asset classes and volatility regimes. Results will vary considerably between trending and ranging conditions, and any timeframe or symbol you test should be evaluated on its own merits using historical data before you draw 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
Strengths of this approach. The advance block is one of the more logically grounded candlestick exhaustion patterns — it does not just look at a single candle but tracks deceleration across three, combined with a growing rejection wick. Pairing that with an ATR-based stretch filter is a genuine attempt to solve the biggest weakness of raw candlestick trading: patterns that fire in the middle of nowhere. By requiring the market to be overextended relative to a moving-average baseline, the strategy tries to trade the pattern only where mean-reversion has the best contextual justification. The fully volatility-scaled stops and targets are also a sensible design choice.
Known limitations. Counter-trend and mean-reversion systems share a well-documented weakness: they trade against momentum, so during strong, sustained trends they can repeatedly fade a move that simply keeps going. A decelerating advance block does not guarantee reversal — a market can pause, consolidate, and then continue in the original direction, stopping the fade out. The strategy also takes only one position at a time and has no re-entry or trailing logic, so a single trade must resolve at its stop or target before the next signal can act. The multi-condition entry filter is strict, which means signals may be infrequent on some symbols, and the fixed lot size does not scale risk to account equity.
Where it may underperform. Expect this style to struggle most in strongly trending environments, during news-driven volatility spikes where ATR readings lag reality, and on instruments with wide or erratic spreads that distort the wick and body measurements. It is likely to be most at home in range-bound or oscillating conditions where price genuinely tends to revert to a mean. As with any single strategy, historically favourable conditions can change, and no filter fully removes the risk of losing trades.
Risk Management Tips
Regardless of how sound a strategy's logic appears, disciplined risk management is what determines whether you can study and trade it responsibly over time. Consider the following general principles:
- Position sizing: The fixed
Lotsdefault of 0.10 is a starting point, not a recommendation. Size your positions relative to your account balance, not a fixed number. - Risk per trade: A widely-taught guideline is to risk no more than 1–2% of your account on any single trade. Because this EA's stop distance is ATR-based, your monetary risk per trade will change with volatility — check it before trading.
- Use a demo account first: Run the EA on a demo account across different market conditions to understand its behaviour, signal frequency, and drawdown profile before ever considering real capital.
- Understand drawdown: Every strategy experiences losing streaks. Study the worst peak-to-trough decline in your testing so you know what to expect emotionally and financially.
- Never over-leverage: Leverage magnifies both gains and losses. Only trade with capital you can afford to lose, and never let a single position threaten your account.
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: AdvanceBlockReversal.ex5 (28 downloads)
- Source Code: AdvanceBlockReversal.mq5 (27 downloads)
- Documentation: AdvanceBlockReversal.pdf (36 downloads)