CandlePatternsExample
This EA demonstrates the use of MQL5 built-in candlestick pattern recognition classes from the Standard Library. It detects classic Japanese candlestick patterns (Engulfing, Harami, Hammer, Doji Star, etc.) and automatically opens buy or sell positions based on the identified pattern signals, using fixed lot sizes and configurable stop-loss/take-profit levels.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
| Symbol | P&L | Annual | Max DD | Trades | Win rate | Sharpe | Recovery | Losing streak | Per trade | Status |
|---|---|---|---|---|---|---|---|---|---|---|
| EURUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| GBPUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| USDJPY | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
| XAUUSD | 0.00% | 0.00% | 0.00% | 0 | — | — | — | — | — | Not convertible yet |
Why this EA never traded: no entry rule survived the conversion.
Converted from MQL5 to Python and run with the same rules for every EA. Positions use MT5 lot sizes (100,000 units per FX lot, 100 oz per gold lot) with 1:100 leverage, one order at a time, and a stop-out below 10% of the starting balance. Sharpe is computed from the equity curve. Results marked as unreliable are shown for completeness only.
Blow-up risk: No blow-up pattern found
- Has no stop loss or trailing stop
On its own this is not a typical blow-up pattern, and the account was not stopped out in our backtests. That is not a guarantee: any EA can lose money.
High: stopped out in our backtest, or martingale/grid sizing without a stop loss. Elevated: martingale or grid sizing with a stop loss, or several positions at once without a stop loss. What the label means and what we found →
Strategy analysis
The core strategy of this EA is based on classic Japanese candlestick pattern recognition for trading decisions, leveraging the CCandlePattern class and its derivatives from the MQL5 Standard Library to detect multiple reversal and continuation patterns. Entry conditions: long positions are opened when bullish candlestick patterns (such as bullish engulfing, morning star, hammer) are detected, and short positions are opened when bearish patterns (such as bearish engulfing, evening star, hanging man) are identified. Exit conditions rely on fixed stop-loss and take-profit levels with no dynamic trailing stop mechanism. Position sizing uses a fixed lot approach without dynamic adjustment based on account balance or risk ratios. Money management is simplistic, lacking maximum position limits or drawdown control mechanisms. The overall strategy represents a classical pattern recognition trading approach, best suited for learning MQL5 EA development frameworks and pattern recognition class usage.
Strengths
- Leverages MQL5 Standard Library pattern recognition classes with clean, well-structured code serving as an excellent learning example
- Covers multiple classic candlestick patterns with intuitive and easy-to-understand strategy logic for easy comprehension and extension
- Built on the Standard Library for high reusability, making it convenient to develop more complex pattern recognition strategies on this foundation
- High degree of code modularity with pattern detection and trading logic properly separated, providing sound architecture
Weaknesses
- Fixed lot sizing without dynamic position management cannot adapt to market volatility or account risk
- Lacks multi-layer filtering mechanisms; relying solely on single candlestick pattern signals easily generates frequent false signals
- No drawdown control or maximum position limits, leading to significant risk exposure during consecutive losses
- Stop-loss and take-profit use fixed pip values without considering ATR or other volatility indicators for dynamic adjustment
- As a sample EA, its live trading performance is limited, lacking sufficient real-market verification and optimization
Possible improvements
- Add multi-timeframe confirmation and multi-indicator filtering (e.g., trend direction, volume confirmation) to reduce false signals
- Introduce ATR-based dynamic stop-loss/take-profit and risk-ratio-based dynamic position sizing
- Add drawdown control mechanisms and maximum simultaneous position limits to enhance money management safety
Risk assessment
Overall risk: Medium
- Single candlestick pattern signals easily generate false trades without multi-dimensional confirmation
- Fixed stop-loss/take-profit ignores market volatility; stops may be too tight during high-volatility conditions
- No drawdown control or maximum position limit mechanisms in place
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
LotSize | 0.1 | Fixed lot size per trade |
StopLoss | 50 | Stop loss in points |
TakeProfit | 100 | Take profit in points (profit target) |
Expiration | 10 | Signal validity period (in bars) |
CandlePatternType | 0 | Candlestick pattern type selection |
Similar Candlestick Pattern EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.