- Strategy
- In an uptrend where the 8 EMA is above the 21 EMA and the 21 is above the 50, buys after a bullish candle dips to the 21 EMA and closes back above it with a long lower wick; sells the mirror in a downtrend. The stop sits beyond the candle and the target is 2R.
- Risk model
- 1% of balance per trade (configurable), stop-loss on every order, one position at a time
What it does
The Triple EMA Pullback EA is a trend-continuation system. It waits for three EMAs to line up in order, showing an established trend, then looks for price to dip back into the middle EMA and get rejected. That rejection candle is the entry trigger.
The stop-loss goes just beyond the rejection candle, so the trade is invalidated if the pullback keeps going. Risk is sized from that distance.
How it works
Signals are checked on each new bar using the candle that just closed.
- Uptrend stack: 8 EMA > 21 EMA > 50 EMA on the signal bar.
- Pullback: the candle's low touched or went below the 21 EMA.
- Rejection: the candle closed above the 21 EMA, closed higher than it opened, and its lower wick is at least 40% of the full high-low range.
- Sell: the mirror (8 < 21 < 50, high reaches the 21 EMA, bearish close below it, upper wick at least 40% of the range).
- Stop-loss: candle low minus 0.25 x ATR(14) for buys (candle high plus the buffer for sells). Signals needing more than 3 x ATR of stop are skipped.
- Target: 2R. Exit: a close beyond the 50 EMA against the position closes it.
How to use it
This approach suits markets that trend in steps, with regular shallow pullbacks, such as major pairs on H1. It will be quiet in ranges, because the EMA stack rarely holds there. The candle rule is a simple version of a pin-bar idea; the candlestick patterns lesson covers the reasoning behind wicks as rejection.
Lowering the wick ratio produces more trades of lower quality; raising it gives fewer, cleaner setups.
Settings
| Input | Default | What it changes |
|---|---|---|
| Fast / pullback / slow EMA | 8 / 21 / 50 | The three EMAs that define the trend stack. |
| Minimum rejection wick | 0.40 | Lower (or upper) wick as a fraction of the candle's range. |
| Stop buffer (x ATR) | 0.25 | Extra distance beyond the candle's low or high. |
| Take-profit (R multiple) | 2.0 | Target as a multiple of the stop distance. |
| Maximum stop (x ATR) | 3.0 | Skips oversized signal candles. |
| Exit on trend break | true | Closes when price closes beyond the 50 EMA. |
| Risk per trade (% of balance) | 1.0 | Share of balance risked between entry and stop. |
| Fixed lots | 0 | Fixed volume instead of risk %; 0 = risk-based. |
| Maximum spread (points) | 20 | Skips signals when the spread is wider; 0 = off. |
| Trading start / end hour | 7 / 20 | Server-time window for new trades; equal values = 24 hours. |
| Move stop to break-even | true | Stop to entry + 20 points once profit reaches 1R. |
| Use trailing stop | false | Trails the stop 2 x ATR behind price. |
| Magic number | 2611008 | Identifies this EA's trades. |
Limitations
- Strong trends sometimes never pull back to the 21 EMA, so the EA can miss the best moves.
- A deep pullback can break the stack and turn into a reversal right after entry.
- Candle-shape rules are sensitive to the broker's server time and bar boundaries.
- Small candles create tight stops that can sit close to the spread and the broker minimum distance.
Before you run it live
Test on a demo account and in the MetaTrader 5 Strategy Tester over several years first. No backtest results are published for this EA, and any test describes the past only.
- Match the spread limit and trading hours to your broker's spreads, stop level and session times, and include commission and swap in tests.
- Start with 1% risk or less and check the lot sizes in the Experts log; the Position Size Calculator is a useful cross-check.
- Use a different magic number on each chart, and keep the terminal (or a VPS) running so stops are managed.
Visual mode in the Strategy Tester is useful here: step through a few signals to confirm the candles match what you expect.

