One of the official TrendCandleEA configurations — self-contained MQL5 Expert Advisor, no external indicator required. Validated on 9 months of 100 % real-tick backtest data on BTCUSD.
1. Introduction
TrendCandleEA is an MQL5 Expert Advisor built on a modular filter engine. Several configurations are shipped with the EA, each one calibrated for a specific market. This article documents the BTC configuration, designed for BTCUSD on the M30 timeframe.
It is a trend continuation system: it looks for a dominant directional bias, then enters on the first sign of momentum resuming after a pullback, and exits on a fixed 1:1 reward-to-risk target.
The BTC configuration uses the same engine as the XAU configuration, but its filter stack has been completely recalibrated for Bitcoin's higher volatility, 24/7 trading, and different market microstructure. The result is a configuration that is extremely selective: roughly 2 trades per month, with a 95 % win rate over the tested period.
The EA is fully self-contained. Every filter — Bollinger Bands, ZigZag, Squeeze Momentum, Moving Averages, ATR, SMC (fair value gaps), and volume analysis — is computed internally from the raw price series. There is no iCustom call, no external .ex5 dependency, no chart indicator required.
2. Strategy Philosophy — Trend Continuation on Bitcoin
The core idea is the same as in every TrendCandleEA configuration: a strong trending market rarely reverses on the first pullback. When price is in a clear trend and prints a continuation candle — one that closes near its extreme with a solid body — the probability of another continuation candle is higher than the probability of an immediate reversal.
On Bitcoin, however, the context matters even more than the candle itself. BTCUSD is notorious for its violent fakeouts, weekend gaps, and sudden liquidation cascades. A strategy that trades every green candle would be chopped to pieces. The BTC configuration therefore relies on stacked context filters that only allow entries when:
- Two independent moving averages (M30 EMA 50 and H4 EMA 200) agree on the trend direction.
- The candle itself is a genuine impulsive candle (body ≥ 50 % of range, body ≥ 0.6 × ATR, close in the last third).
- A squeeze has just released on the Squeeze Momentum indicator — i.e. volatility was compressed and is now expanding.
- A recent fair value gap (FVG) exists in the direction of the trade.
- Two ZigZag filters (M30 + H4) confirm the current leg direction.
- Volume on the M15 timeframe is above average and rising.
The result is a filter stack that fires rarely but with high conviction. Twenty trades over nine months, one loss, and a Profit Factor of 11,77.
3. The Filter Stack
Below are the filters that are active in the BTC configuration. All other filters (ADX, RSI, MACD, Bollinger Modality B, Virgin Price, Fibonacci, IBS, Stochastic, Volumes Indicator) are disabled in this configuration — they remain available as inputs but have no effect.
3.1 Matrend — M30 EMA 50
Price must be on the correct side of a 50-period EMA on M30, and the entire body of the signal candle must be above (for BUY) or below (for SELL) that EMA. This is the primary local trend filter.
3.2 Higher Timeframe MA — H4 EMA 200
An H4 EMA 200 provides the higher timeframe bias. Price must be above it for BUY, below it for SELL. This is the macro trend filter that keeps the EA aligned with the dominant direction.
3.3 Candle Quality Filter
Three sub-conditions must all be true on the signal candle:
- Body / range ratio ≥ 0,50 (the body must represent at least half of the candle's total range).
- Body ≥ 0,60 × ATR(2) — a very short ATR period is used intentionally here, so the reference is recent volatility, not the smoothed average.
- Close in the last third of the range, in the direction of the trade.
3.4 Squeeze Momentum (SQZ_RELEASE_RECENT)
The EA includes an internal, self-contained Squeeze Momentum calculation (Bollinger / Keltner compression + linear regression momentum). In SQZ_RELEASE_RECENT mode, the signal candle must not be inside a squeeze, and a squeeze must have been present within the last 3 candles. This is the classic "squeeze pop" setup — volatility compressed, then released.
3.5 Bollinger Modality A — H4 Median
On H4, price must be on the correct side of the 200-period median line of a BB(200, 2.0). Additionally, entries that occur too close to the outer band are rejected ( InpBbRejectOuterBandEntries = true ). This ensures entries are not made at the very extreme of an extended move.
3.6 Smart Money Concept — FVG only
Among all SMC sub-conditions, only the Fair Value Gap requirement is enabled. A recent directional FVG (within the last 6 candles) must exist. This confirms that there is an inefficiency in the market that price is likely to respect as support/resistance.
3.7 ZigZag #1 — M30, Depth 12
An internal ZigZag with Depth 12, Deviation 5, Backstep 3 determines the direction of the current leg on M30. The EA only trades in the direction of that leg.
3.8 ZigZag #2 — H4, Depth 12
A second, independent ZigZag on H4 (same parameters) provides a higher timeframe leg confirmation. Both ZigZags must agree on the direction.
3.9 Volume Filter — M15
Volume on the M15 timeframe must be at least 1,20 × the 20-candle average, and higher than the previous candle's volume. This ensures that the signal occurs during real market participation, not during quiet periods.
3.10 Exit Mode — Fixed TP = SL distance
A 1:1 reward-to-risk target is used. The SL is placed below the low (for BUY) or above the high (for SELL) of the signal candle, plus a 10 000-point buffer. The TP is placed at the same distance as the SL.
4. Configuration
| Parameter | Value |
|---|---|
| Symbol | BTCUSD |
| Timeframe | M30 |
| InpMagic | 1004 (distinct from the XAU configuration's 1003) |
| InpTradeComment | BtcTrendCandle (recommended — see Section 8) |
| InpSlippagePoints | 3 000 |
| InpMaxSpreadPoints | 6 000 |
| Matrend (EMA 50, body above/below) | ON |
| HTF MA (H4 EMA 200) | ON |
| Candle quality (ATR 2) | ON |
| Squeeze Momentum (release recent) | ON |
| Bollinger Modality A (H4 median) | ON |
| SMC (FVG only) | ON |
| ZigZag #1 (M30, Depth 12) | ON |
| ZigZag #2 (H4, Depth 12) | ON |
| Volume filter (M15) | ON |
| ADX filter | OFF |
| RSI filter | OFF |
| MACD filter | OFF |
| Bollinger Modality B (outer band touch) | OFF |
| Virgin Price filter | OFF |
| SL buffer | 10 000 points |
| Exit mode | Fixed TP = SL distance (1:1) |
| Lot mode | Fixed lot 0,01 |
5. Backtest Environment
| Item | Value |
|---|---|
| Broker | Tickmill-Demo |
| Platform | MetaTrader 5 (Build 6182) |
| Symbol | BTCUSD |
| Timeframe | M30 |
| Period | 2026.01.01 → 2026.09.09 (9 months) |
| Modelling | Every tick based on real ticks |
| History quality | 100 % real ticks |
| Initial deposit | 1 000 USD |
| Leverage | 1:500 |
| Bars | 11 945 |
| Ticks | 85 132 331 |
6. Results in Depth
| 20 Trades | 95,00 % Win Rate | 11,77 Profit Factor | 1,02 % DD Balance Max | 17,59 Sharpe Ratio | 5,62 Recovery Factor |
6.1 Global Statistics
| Metric | Value |
|---|---|
| Total Net Profit | 120,18 USD (+12,02 %) |
| Gross Profit | 131,34 USD |
| Gross Loss | −11,16 USD |
| Profit Factor | 11,77 |
| Expected Payoff | 6,01 USD / trade |
| Sharpe Ratio | 17,59 |
| Recovery Factor | 5,62 |
| Balance Drawdown Maximal | 11,16 USD (1,02 %) |
| Equity Drawdown Maximal | 21,38 USD (2,05 %) |
| Total Trades | 20 |
| Profit Trades | 19 (95,00 %) |
| Loss Trades | 1 (5,00 %) |
| Average Profit Trade | 6,91 USD |
| Average Loss Trade | −11,16 USD |
| Largest Profit Trade | 17,92 USD |
| Largest Loss Trade | −11,16 USD |
| Max Consecutive Wins | 13 (98,10 USD) |
| Max Consecutive Losses | 1 (−11,16 USD) |
| Average Holding Time | 5 h 41 min |
6.2 Directional Breakdown
The configuration was active in both directions: 7 long trades (100 % win rate) and 13 short trades (92,31 % win rate). This is a notable difference from the XAU configuration, which was entirely long-biased during its test window. On Bitcoin, the calibrated filter stack successfully identified both up-legs and down-legs.
6.3 Key Observations
- Extremely high win rate: 19 wins out of 20 trades. The single loss was on 19 June 2026 (a −11,16 USD SL hit on a short position).
- Very low drawdown: 1,02 % maximum balance drawdown for a +12,02 % net return is remarkable. The equity drawdown of 2,05 % is the worst the configuration experienced at any point.
- Exceptional Profit Factor: 11,77 is unusually high and reflects both the win rate and the near-symmetric risk/reward ratio of the winning trades.
- Long holding times: average 5 h 41 min, with a maximum of 26 h 39 min. This is a swing-oriented configuration, not a scalping one.
- Sparse trading: 20 trades over 9 months is approximately 2,2 trades per month. This requires patience and discipline.
7. Risk Management & Position Sizing
The backtest used a fixed lot of 0,01, which corresponds to a very small absolute risk per trade on BTCUSD — the average win was 6,91 USD and the single loss was 11,16 USD, both tiny relative to the 1 000 USD initial deposit.
For live trading, two modes are available:
- Fixed lot ( LOT_FIXED ) — the same volume is used for every trade. Simple, but does not adapt to account growth or SL distance.
- Risk-based lot ( LOT_RISK_PCT ) — the lot is computed so that the distance between entry and SL corresponds to a fixed percentage of account equity. Recommended for live trading, especially on a volatile asset like BTC.
On Bitcoin, a maximum daily loss limit ( InpMaxDailyLossPct ) is strongly recommended. BTC can gap significantly overnight and a single bad day can wipe out weeks of gains if risk is not capped.
8. How to Use the EA
8.1 Installation
- Open MetaTrader 5.
- In the Navigator, right-click Expert Advisors → Open Folder.
- Copy TrendCandleEA.mq5 into that folder.
- In MetaEditor, press F7 to compile. No dependency is required.
- Drag the EA from the Navigator onto a BTCUSD M30 chart.
- In the input window, paste the parameters listed in Section 4.
8.2 Recommended Customization — Trade Comment
The EA ships with a default trade comment of BtcTrendCandle in the BTC configuration. If you use the shared source file, make sure this field is set accordingly before starting the EA.
This is not cosmetic. When you check open positions from the MetaTrader 5 mobile app — or when you have several configurations running on the same account — the trade comment is the only reliable way to instantly identify which configuration opened a given position. A clear, market-specific comment prevents any confusion between the XAU and BTC instances of the EA.
8.3 Operational Notes
- The EA trades only on closed candles. Signals are evaluated once per M30 bar close.
- The trailing stop (when enabled) is managed on every tick, independently of new bar detection.
- Trailing state is persisted in global variables, so the EA recovers cleanly after a terminal restart, a disconnection, or a power outage.
- ZigZag and Volumes Indicator chart objects are automatically created and removed by the EA. Nothing is left behind on the chart when the EA is removed.
- Because BTC trades 24/7, the session filter is disabled in this configuration. If your broker applies significant weekend swap or spread widening, consider re-enabling it.
9. Conclusion
The BTC configuration of TrendCandleEA is a highly selective trend continuation system tailored to BTCUSD M30. Its filter stack — combining two moving averages, candle quality, squeeze momentum, fair value gaps, two ZigZags, and volume — is designed to trade rarely but with high conviction.
Over 9 months of 100 % real-tick backtest on Tickmill-Demo, the configuration documented here produced:
- 20 trades, a 95,00 % win rate (19 wins / 1 loss),
- Profit Factor of 11,77,
- +12,02 % net return with only 1,02 % maximum balance drawdown and 2,05 % maximum equity drawdown,
- Sharpe Ratio of 17,59,
- Balanced exposure across both directions: 7 long and 13 short trades.
Whether this configuration represents an optimum or a reflection of the specific market regime tested is a question that only future data can answer. Traders who deploy it live are strongly encouraged to run it on a demo account first, to use risk-based position sizing, and to set a maximum daily loss limit.
Thank you for reading. Feedback, bug reports and suggestions are welcome in the comments section.


