At MetaBacktest, we specialize in turning classical candlestick patterns into robust algorithmic strategies.
One of the most powerful two-candle reversal formations are the Piercing Pattern (bullish) and the Dark Cloud Cover (bearish).
In this article, we introduce our brand-new MQL4 Expert Advisor (EA) that trades these patterns automatically, enhanced with smart money management, RSI-based risk control, and optimization features.
Understanding the Patterns
Piercing Pattern (Bullish Reversal)
- Appears at the end of a downtrend.
- First candle: long bearish body .
- Second candle: opens lower (gap down) but then closes above the midpoint of the previous bearish candle.
- Interpretation: sellers lose strength and buyers take control → potential bullish reversal.
Dark Cloud Cover (Bearish Reversal)
- Appears at the end of an uptrend.
- First candle: long bullish body .
- Second candle: opens higher (gap up) but then closes below the midpoint of the previous bullish candle.
- Interpretation: buyers lose strength and sellers take over → potential bearish reversal.
Both patterns are highly respected among discretionary traders. With this EA, they are traded with strict rules and automated execution.
Features Implemented
All parameters of the following features are adjustable, making it fully optimization-ready for different markets and timeframes:
- Piercing Pattern → Buy
- Dark Cloud Cover → Sell
- Time & weekday filters
- Smart money management (risk %, lot size):
- Lot sizes are auto-calculated based on stop loss distance.
- Broker restrictions (min/max lot, lot step) are handled automatically.
- Total trade limits and per-direction limits
- RSI-based dynamic SL/TP (optional fixed SL/TP)
- Pattern optimization parameters:
- MinBodySizePips
- PatternPenetration
- MaxGapPips
- Optional bar-close evaluation
- 5-digit broker support
Why This EA is Powerful
Candlestick trading works best when combined with
discipline and consistency.
Most discretionary traders fail because:
- They hesitate to enter when the pattern forms.
- They trade too aggressively without risk control.
- They misinterpret weak signals.
This EA solves all of that:
- No emotions.
- Precise execution.
- Strict money management.
- Optimizable for different pairs and sessions.
Backtest Results by MetaBacktest
We ran multiple backtests of the
MQL4 Expert Advisor using
MetaBacktest to ensure fair and transparent results.
Test Parameters:
- Instrument : EURUSD
- Timeframe : M1
- Period : Jan 2012 – Aug 2025
- Lot Size : Risk/SL-Based, Floating Lot Size
- Stop Loss / Take Profit : RSI-Based, Floating
- % of RSI range for sl : 4.3
- % of RSI range for tp : 2.3
- Max Concurrent Trades : 4
- Minimum candle body size : 5.4
* You can download the setting file from the Download Box below
Process time: 0:01:54.672
Key Results:
Test Parameters:
- Instrument : EURUSD
- Timeframe : H1
- Period : Jan 2012 – Aug 2025
- Lot Size : Risk/SL-Based, Floating Lot Size
- Stop Loss / Take Profit : 100, Fixed
- % of RSI range for sl : 4.3
- % of RSI range for tp : 2.3
- Max Concurrent Trades : 14
- Trading start hour : 8
- Trading end hour: 12
- Minimum candle body size : 5.0
* You can download the setting file from the Download Box below
Process time: 0:00:53.625
Key Results:
Test Parameters:
- Instrument : USDJPY
- Timeframe : M15
- Period : Jan 2012 – Aug 2025
- Lot Size : Risk/SL-Based, Floating Lot Size
- Stop Loss / Take Profit : RSI-Based, Floating
- % of RSI range for sl : 2.3
- % of RSI range for tp : 5.3
- Max Concurrent Trades : 40
- Trading start hour : 10
- Trading end hour: 12
- Minimum candle body size : 6.66
* You can download the setting file from the Download Box below
Process time: 0:00:32.438
Key Results:
Comparison by MetaBacktest:
Final Thoughts
The
Piercing Pattern & Dark Cloud Cover EA is a complete candlestick reversal trading system, wrapped in one professional algorithm.
It combines
classical price action logic with
modern risk management and
automation.
Whether you’re a researcher, trader, or backtester, this EA is an excellent tool for testing how these patterns really perform in live markets.
At
MetaBacktest.com, our mission is to make trading
transparent, rule-based, and data-driven.
This EA is another step toward bridging
classic trading wisdom with
modern algorithmic execution.
Before going live, always run thorough backtests to adapt the EA to your pair, timeframe, and risk tolerance.
Piercing-and-Dark-Cloud-Cover_MetaBacktest.ex4
Piercing-and-Dark-Cloud-Cover_MetaBacktest.mq4
EURUSD-M1_Setting.set
EURUSD-H1_Setting.set
USDJPY-M15_Setting.set
Result-EURUSD-M1.zip
Result-EURUSD-H1.zip
Result-USDJPY-M15.zip
Please Login or Signup
to be able to download the files.
Just wanted to say thanks. I’ve read dozens of candlestick articles but this one gave me something practical. Big respect!
This is such a refreshing breakdown of the Piercing Pattern & Dark Cloud Cover! Most blogs oversimplify, but you went deep into how to actually use them in trading.
Totally agree. I especially liked the part about combining RSI-based SL/TP — that’s way more practical than a static 30 pips stop.
The combination of classic candle patterns, risk management, and optimization makes me feel confident to try it out. Thank you for writing clearly and showing realistic backtest results.
I like the concept, but purely price-action + reversal pattern EAs often miss out when trends are strong. Would adding a trend filter (like EMA or MACD filter) improve this so trades are taken only in trend-pullback contexts?
Cool—you might even let users optimize that EMA period per pair. For example, a 200 EMA works better on USDJPY, while GBPUSD might need shorter.
Really solid write-up! I appreciate how you broke down the Piercing Pattern and Dark Cloud Cover with both logic and trading usability. The fact that the EA supports pattern penetration, candle body size, and max gap makes this feel usable for live settings.