Skip to content

Free MT5 Expert Advisor

Engulfing Reversal EA

MT5 Expert Advisor that trades bullish and bearish engulfing candles at a Bollinger Band or swing extreme, with the stop beyond the pattern.

Price actionv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Stop-loss on every trade
Strategy
Buys after a bullish engulfing candle that touches the lower Bollinger Band or makes a swing low, and sells after a bearish engulfing candle at the upper band or a swing high. The stop goes beyond the two-candle pattern.
Risk model
1% of balance per trade (configurable), stop-loss beyond the pattern on every order, one position at a time

What it does

An engulfing pattern is a two-candle reversal: a candle in one direction followed by a larger candle in the other direction whose body covers the first body. Engulfing Reversal EA trades it only at a stretched location, either outside a Bollinger Band or at a recent swing extreme.

How it works

On every new bar the EA checks the last two closed bars (the older one is bar 2, the newer one is bar 1):

  • Bullish engulfing: bar 2 closed down, bar 1 closed up, bar 1 opened at or below bar 2's close, closed at or above bar 2's open, and has the larger body.
  • Bearish engulfing: the mirror image.
  • Band location: for a buy, the low of either bar touched or broke the lower Bollinger Band (20, 2.0); for a sell, the high of either bar touched the upper band.
  • Swing location: the lowest low (buy) or highest high (sell) of the last 10 bars belongs to one of the two pattern bars.
  • Body filter: bar 1's body must be at least 0.3 × ATR(14).
  • Stop-loss: beyond the pattern's extreme plus 0.1 × ATR. Setups with a stop wider than 3 × ATR are skipped.
  • Take-profit: 2 × the stop distance.

On forex charts the second candle often opens at the previous close, so "opens at or below the close" is written as an inequality rather than requiring a gap. The candlestick patterns and Bollinger Bands lessons give more background.

How to use it

Choose "Band or swing" for the most signals, or one of the stricter location modes for fewer. H4 and D1 engulfing patterns tend to be cleaner than intraday ones. Combine it with your own view of the larger trend if you supervise the EA, and size positions with the Lot Size Calculator when comparing settings.

Settings

InputDefaultWhat it changes
Location modeBand or swingWhere the pattern must form
Bollinger period / deviation20 / 2.0Band location
Swing lookback10Swing location
Min body (x ATR)0.3Ignores small patterns
Stop buffer / Max stop (x ATR)0.1 / 3.0Stop placement
Reward:risk target2.0Take-profit, 0 disables it
Risk per trade / Fixed lots1.0% / 0Position sizing
Max spread / Trading hours30 / 7–20Filters
Break-even / Trailingon / offStop management

Limitations

Engulfing candles are common and many are not reversals, especially in strong trends where they mark only a brief pause. The entry comes after a large candle, so the stop beyond the pattern can be wide. The rules ignore context such as higher-timeframe trend or news.

Before you run it live

Backtest each location mode in the Strategy Tester on several symbols, then run your preferred setup on a demo account. Check spreads and the broker's stop level, and keep risk per trade low. Past behavior does not guarantee future results.

Key inputs

Key inputs of Engulfing Reversal EA
InputDefaultDescription
Where the pattern must formBand or swingLocation rule: Bollinger Band, swing extreme, or either.
Bollinger period20Bars used for the bands.
Swing extreme lookback (bars)10The pattern must make the lowest low or highest high of this many bars.
Minimum engulfing body (x ATR)0.3Ignores small engulfing candles.
Stop buffer beyond the pattern (x ATR)0.1Room added beyond the pattern extreme.
Take-profit as a multiple of the stop (0 = none)2.0Reward-to-risk target.

Educational tools, not advice. Automated trading can lose money quickly. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 expert advisors