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 Piercing Cloud Reversal is a price-action reversal strategy built on two of the oldest and most widely studied Japanese candlestick patterns — the Piercing Line (a bullish two-candle reversal) and its mirror image, the Dark Cloud Cover (a bearish two-candle reversal). Rather than trading these patterns wherever they appear, the strategy layers a support/resistance liquidity-sweep filter and an Average True Range (ATR) volatility filter on top, so it only acts when the pattern forms at a meaningful level. ATR is a common volatility indicator that measures the average size of a candle's range over a set number of bars. The trading style here is short-term, single-timeframe swing/reversal trading: it waits patiently for a specific structure to appear, then enters once.
The core idea is about absorption and rejection. A strong "drive" candle pushes hard in one direction. The very next candle pokes past a recent swing high or low — appearing to break out and "grab liquidity" resting beyond that level — but then closes back through the midpoint of the drive candle's body. That partial recovery, deliberately not a full engulfing, is the classic signature of the Piercing/Dark-Cloud family. It suggests the breakout was rejected and the prior move may be losing steam.
This strategy is best suited as a learning tool for traders studying candlestick patterns, support and resistance, and liquidity concepts. It is a clean, rules-based way to see how a textbook reversal pattern can be made more selective by adding context. It is not a shortcut to results, and the sections below are framed as analysis of how the logic behaves — not as a promise of outcomes.
How It Works
The strategy evaluates its rules once per completed bar (it ignores the still-forming candle) and holds at most one position per symbol at a time. When a signal fires, here is what the logic checks and does.
Entry conditions — Bullish Piercing Line (long):
- The strategy signals a potential long only when the drive candle (c2) is bearish — it closed lower than it opened.
- That drive candle must be "big," meaning its body is at least
MinBodyAtr× ATR. This filters out weak, indecisive candles. - The signal candle (c1) must sweep below the recent support level — its low dips under the lowest low of the lookback window directly before it.
- The signal candle must then close back above the midpoint of the drive candle's body (the partial reclaim) but below the drive candle's open — confirming it is a partial recovery, not a full bullish engulfing.
- The signal candle must itself be bullish (close above open).
- When all of these align, the strategy enters a buy at the current ask price on the open of the following bar.
Entry conditions — Bearish Dark Cloud Cover (short):
- The mirror logic applies: the drive candle (c2) is bullish and "big" (body ≥
MinBodyAtr× ATR). - The signal candle (c1) sweeps above the recent resistance level.
- It closes back below the drive body's midpoint but above the drive candle's open — a partial bearish reclaim, not a full engulf.
- The signal candle is itself bearish.
- The strategy then enters a sell at the current bid price.
Stop-loss logic:
- For a long, the stop is placed below the signal candle's low, with an extra buffer of
AtrStopMult× ATR. This keeps the protective stop just beyond the swept extreme. - For a short, the stop sits above the signal candle's high, plus the same ATR buffer.
- Because the buffer scales with ATR, the stop distance automatically widens in volatile conditions and tightens in quiet ones.
Take-profit logic:
- The distance from entry to stop defines the trade's risk. The target is then placed at
RewardRisk× risk away from entry. - With the default
RewardRiskof 1.6, the strategy aims for a reward 1.6 times the size of the initial risk. The trade exits when either the stop or the target is reached.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade size in lots for each position the strategy opens. |
| AtrPeriod | 14 | 7 | 28 | Number of bars used to calculate the ATR volatility measure for stops and the body filter. |
| AtrStopMult | 0.5 | 0.1 | 2.0 | ATR multiple added beyond the signal candle's extreme to set the stop-loss buffer. |
| RewardRisk | 1.6 | 0.5 | 4.0 | Reward-to-risk ratio; the take-profit distance as a multiple of the stop distance. |
| LevelLookback | 12 | 5 | 40 | Number of bars scanned before the signal candle to define recent support and resistance. |
| MinBodyAtr | 0.5 | 0.1 | 2.0 | Minimum drive-candle body size, expressed as a multiple of ATR, to qualify as a strong drive. |
The expert advisor also uses a fixed Magic number (default 7421) to identify and manage only its own positions, leaving any other trades on the account untouched.

Recommended Chart Settings
This strategy was designed as a single-timeframe system, meaning all of its signals come from the chart it is attached to. Candlestick reversal patterns like the Piercing Line and Dark Cloud Cover are most commonly studied on intraday-to-swing timeframes such as M30, H1, and H4, where individual candles carry enough structure for the sweep-and-reclaim logic to be meaningful. Major forex pairs (for example EUR/USD, GBP/USD, or USD/JPY) are a natural starting point for study because their liquidity tends to produce cleaner swing levels.
There is no universally "correct" symbol or timeframe. Behavior will vary considerably across instruments, sessions, and market conditions, so treat any chosen setting as a hypothesis to test rather than a fixed rule. Always study the strategy on a demo account across several market environments 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
Strengths of the approach. The Piercing Cloud Reversal is conceptually clear and selective. By requiring a liquidity sweep of a recent level and a strong drive candle and a partial-reclaim close, it filters out many of the random candlestick patterns that appear in noisy price action. The ATR-based stop adapts to volatility, and the fixed reward-to-risk target enforces a consistent, pre-defined exit plan — a discipline many discretionary traders struggle to maintain.
Known limitations. Candlestick reversal patterns are, by nature, probabilistic and context-dependent. The Piercing Line and Dark Cloud Cover do not reliably mark tops and bottoms; they simply describe a possible shift in short-term momentum that may or may not follow through. Because the strategy insists on a partial reclaim (≥50% but <100% of the drive body), it intentionally passes on full-engulfing reversals that some traders consider stronger. It also takes only one position at a time and enters at market on the next bar, so fast-moving markets can produce slippage between the signal and the fill.
Where it may underperform. Strong, persistent trends can repeatedly sweep levels and keep going, turning "reversal" signals into losses against the dominant move. Very quiet, range-bound conditions may rarely produce a drive candle large enough to pass the MinBodyAtr filter, leading to long stretches with no trades. As always, results will differ across symbols, timeframes, and broker conditions — the logic is a framework for study, not a finished system.
Risk Management Tips
Sound risk management matters more than any single entry signal. Consider these general, educational principles:
- Risk a small, fixed fraction per trade. Many educators suggest risking no more than 1–2% of account equity on any single position, sized so that hitting the stop-loss costs only that amount.
- Size positions to the stop, not the other way around. Because this strategy's stop distance is ATR-driven and varies, a fixed lot size will not always equal a fixed percentage of risk. Adjust your lots so the worst-case loss stays within your chosen percentage.
- Always start on a demo account. Forward-test the strategy in simulation across different market conditions before considering any live use.
- Understand drawdown. Even a logically sound strategy will have losing streaks. Know how large a string of losses you could tolerate emotionally and financially before committing capital.
- Keep expectations grounded. Treat backtests and demo results as study material, not forecasts. No parameter set removes the underlying market risk.
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: PiercingCloudReversal.ex5 (3 downloads)
- Source Code: PiercingCloudReversal.mq5 (4 downloads)
- Documentation: PiercingCloudReversal.pdf (3 downloads)