PipLedger
Today's forex newsNFP, CPI, FOMC and other high-impact eventsEconomic calendarCalendar →

Engulfing candle strategy: rules, a worked example and a free Pine Script

An engulfing candle is a two-candle reversal pattern: a candle in one direction, followed by a bigger candle the other way whose body swallows the first one. On its own it appears all the time. At the end of a pullback in a trend, it's a setup many price action traders watch for. This guide gives exact rules, a worked GBPJPY example with the yen pip maths, and a free TradingView script.

By M. A. Horaira. Updated 10 October 2026. 9 minute read.

The rules at a glance

  • The pattern: a bearish candle followed by a bullish candle whose body covers the whole of its body (bullish engulfing), or the reverse
  • Strength: the engulfing body is at least half the 14-period ATR
  • Location: the pattern makes the lowest low of the last 10 candles (highest high for a bearish engulfing)
  • Trend: longs only above the 200 EMA, shorts only below it
  • Entry, stop and target: enter at the close; stop a quarter of the ATR below the pattern's low (above its high for shorts); target twice the risk (2R)

What an engulfing candle is

A bullish engulfing pattern is two candles. The first is bearish. The second is bullish, opens at or below the first candle's close and closes at or above its open, so its body covers the whole of the first candle's body. It says the sellers had the first candle and the buyers took all of it back, and more, in the second. A bearish engulfing is the mirror image.

In stock markets the second candle often opens with a gap. In forex, one candle usually opens where the last one closed, so the rule here is "opens at or below the previous close", not strictly below. The candlestick patterns guide shows the pattern next to 16 others.

Why location matters more than the pattern

Engulfing candles appear constantly, including in the middle of nowhere. The pattern means far more when it comes at the end of a pullback in an established trend: the trend is up, the price has dipped, and then one strong candle wipes out the last bit of selling. That's why these rules ask for three things besides the pattern itself:

Many traders also like the pattern at a support level or after a liquidity sweep of a recent low; both are filters you can test by hand.

The rules, step by step

1. Check the trend

Longs only above the 200 EMA, shorts only below it.

2. Spot the pattern at the close

A bearish candle, then a bullish candle that opens at or below its close, closes at or above its open, and has a body of at least half the 14-period ATR.

3. Check the location

The lower of the two candles' lows must be the lowest low of the last 10 candles.

4. Enter at the close, stop below the pattern

Enter as the engulfing candle closes. The stop goes below the pattern's low, minus a quarter of the ATR. The target is twice the risk.

Worked example: GBPJPY, 1-hour chart

Target 208.642Entry 207.490Stop 206.914Bullish engulfing2R
Illustrative chart drawn for this guide to show the rules. It isn't a real day's prices. GBPJPY, 1-hour candles. The 200 EMA is left out to keep it readable.

GBPJPY is in an uptrend and pulls back for about half a day. A bearish candle closes at 207.080. The next candle opens at 207.060, dips to 206.970, the lowest low in 10 candles, and closes at 207.490, above the bearish candle's open of 207.300. Its body is about 43 pips, well over half the ATR. With the price above the 200 EMA, that's a long signal.

GBPJPY profits and losses are in yen; their dollar value moves with USDJPY.
GBPJPY long
Entry207.490
Stop loss206.914 (pattern low 206.970 minus a quarter of the ATR), 57.6 pips away
Target (2R)208.642, 115.2 pips away
Pip value1 pip on 1 lot is ¥1,000, which is $6.34 with USDJPY at 157.67
Account and risk$10,000, risking 1% = $100
Lot size$100 ÷ (57.6 pips × $6.34) = 0.274, rounded down to 0.27 lots
Loss if the stop is hitabout $99
Profit at the targetabout $197

The trend picks up again and the target is reached 17 hours after the entry. GBPJPY moves a lot, so its stops are often wider in pips than on EURUSD; the lot size takes care of that.

Risk management

Common mistakes

  1. Trading every engulfing candle. Without the trend and location filters, the pattern is very common and much less meaningful.
  2. Engulfing the wicks instead of the body. The classic pattern compares bodies.
  3. Entering before the close. A candle can look like an engulfing halfway through and finish as something else.
  4. Stops just under the low. The price often comes back to test the low. The ATR buffer gives it room.

Another candle-based setup with a clear stop is the inside bar strategy.

Backtest it yourself on TradingView

This page doesn't quote a win rate or a profit figure, and you should be wary of anyone who does without showing the test. Results change with the market, the dates, the data feed and the costs you put in. The honest way is to run the test yourself, and the free script below does the work in a couple of minutes.

  1. Open the chart. On TradingView, open GBPJPY on the 1-hour chart.
  2. Add the script. Open the Pine Editor from the Pine icon in the panel on the right of the chart (older layouts have it as a tab under the chart), delete the code that's already there, paste this strategy's code and click "Add to chart".
  3. Put in your costs. Open the strategy's settings and go to Properties. Enter your broker's commission and a little slippage. A test without costs flatters every strategy, and short-term ones most of all.
  4. Read the Strategy Tester. The panel under the chart shows the net profit, the maximum drawdown, the profit factor, the number of trades and a list of every trade. Click a few trades and check on the chart that each one follows the rules. Trade sizes are shown in units rather than lots: 100,000 units is one lot of a forex pair, and 100 ounces is one lot of gold.
  5. Change one setting at a time. Compare the location rule on and off, the minimum body size (0.3 to 1 × ATR), the 10-candle lookback and the 2R target against 1.5R. Then try EURUSD, XAUUSD and the 4-hour chart.

As a rough guide, don't trust a result with fewer than 100 trades, a profit factor under 1 once costs are in, or a drawdown you couldn't sit through with real money. Settings tuned to look good on one stretch of history often fail on the next, so check the same settings on dates you didn't tune them on, then demo trade the strategy for a few weeks. How much history you can test depends on your TradingView plan: the free plan loads 5,000 candles, which is a few months of 15-minute candles but years of daily ones.

The script sizes each trade from the stop loss and your risk percentage, starts with $10,000 and assumes 1:100 leverage (a 1% margin setting), so the tester doesn't flag margin calls on normal forex trade sizes. Change these under Properties to match your account. By default TradingView fills orders at the open of the candle after the signal, so the fill can differ a little from the signal candle's close.

Download the free Pine Script and PDF

The script is written in Pine Script version 6 for this guide and follows the rules above. It can't read the economic calendar, so skipping news days is up to you. It's free to use, change and share. The PDF is a one-page cheat sheet with the rules, a worked example, the lot size maths and a checklist, to keep next to your chart.

Show the code (Pine Script v6, 56 lines)
//@version=6
// Engulfing Candle strategy by PipLedger (https://pipledgerfx.com/engulfing-candle-strategy)
// Trades a bullish engulfing candle at a fresh swing low in an uptrend, and a bearish one at a swing high in a downtrend.
// Free to use and change. For education and backtesting only; not financial advice.
strategy("PipLedger: Engulfing Candle", shorttitle="Engulfing", overlay=true, initial_capital=10000, pyramiding=0, default_qty_type=strategy.fixed, default_qty_value=1, margin_long=1, margin_short=1, currency=currency.USD)

// ---------- Inputs
useTrend  = input.bool(true, "Only trade in the direction of the 200 EMA")
atSwing   = input.bool(true, "Pattern must make the lowest low (highest high) of recent candles")
swingBars = input.int(10, "Recent candles to check", minval=2)
minBody   = input.float(0.5, "Engulfing body at least (x ATR 14)", minval=0.0, step=0.1)
stopBuf   = input.float(0.25, "Stop buffer beyond the pattern (x ATR)", minval=0.0, step=0.05)
rr        = input.float(2.0, "Target (R multiple)", minval=0.5, step=0.25)
riskPct   = input.float(1.0, "Risk per trade (% of equity)", minval=0.1, maxval=5.0, step=0.1)

// ---------- Helpers
fx = strategy.convert_to_account(1.0)  // one unit of the chart's quote currency in account currency (1 on USD-quoted charts)
calcQty(float entry, float stop) =>
    float dist = math.abs(entry - stop)
    dist > 0 and not na(fx) ? strategy.equity * riskPct / 100 / (dist * syminfo.pointvalue * fx) : 0.0

atr    = ta.atr(14)
ema200 = ta.ema(close, 200)
patLow  = math.min(low, low[1])
patHigh = math.max(high, high[1])
lowest  = ta.lowest(low, swingBars)
highest = ta.highest(high, swingBars)

// bullish engulfing: a bearish candle, then a bullish candle whose body covers the whole of its body
bullEng = close[1] < open[1] and close > open and open <= close[1] and close >= open[1] and close - open >= minBody * atr
bearEng = close[1] > open[1] and close < open and open >= close[1] and close <= open[1] and open - close >= minBody * atr

flat     = strategy.position_size == 0
longSig  = flat and bullEng and (not useTrend or close > ema200) and (not atSwing or patLow <= lowest)
shortSig = flat and bearEng and (not useTrend or close < ema200) and (not atSwing or patHigh >= highest)

if longSig
    float sl = patLow - atr * stopBuf
    float q  = calcQty(close, sl)
    if q > 0
        strategy.entry("Long", strategy.long, qty=q)
        strategy.exit("Long exit", "Long", stop=sl, limit=close + (close - sl) * rr)

if shortSig
    float sl = patHigh + atr * stopBuf
    float q  = calcQty(close, sl)
    if q > 0
        strategy.entry("Short", strategy.short, qty=q)
        strategy.exit("Short exit", "Short", stop=sl, limit=close - (sl - close) * rr)

// ---------- Chart
plot(useTrend ? ema200 : na, "200 EMA", color=color.new(color.gray, 0))
plotshape(bullEng, "Bullish engulfing", shape.triangleup, location.belowbar, color.new(color.teal, 40), size=size.tiny)
plotshape(bearEng, "Bearish engulfing", shape.triangledown, location.abovebar, color.new(color.red, 40), size=size.tiny)
plotshape(longSig, "Long", shape.labelup, location.belowbar, color.teal, text="Buy", textcolor=color.white, size=size.tiny)
plotshape(shortSig, "Short", shape.labeldown, location.abovebar, color.red, text="Sell", textcolor=color.white, size=size.tiny)

Trading this from India

Residents can trade EURUSD, GBPUSD and USDJPY futures and options on NSE and BSE through a SEBI-registered broker. The contracts are quoted the same way as the spot pair, one lot is 1,000 units of the base currency, and they're cash-settled in rupees. They trade only from 9 a.m. to 7:30 p.m. IST, volumes are thin and not every broker offers them, so check the hours and the spread first. Trading forex or CFDs with offshore online platforms isn't allowed for residents under FEMA, even if the app is easy to download. Details are in is forex trading legal in India.

Related strategies: break and retest, inside bar, previous day high and low, liquidity sweep, XAUUSD pin bar, support and resistance bounce. All 34 strategies are compared on one page in forex trading strategies.

Quick answers

What is a bullish engulfing candle?

A two-candle pattern: a bearish candle followed by a bullish candle whose body covers the whole of the first candle's body. It shows buyers taking back everything the sellers did, and more.

Is an engulfing candle a reversal signal?

It can be, especially at the end of a pullback in a trend or at a key level. On its own, in the middle of a range, it tells you much less, which is why these rules add trend and location filters.

What is the difference between engulfing and outside bar?

An engulfing pattern compares candle bodies. An outside bar compares the full ranges: its high is above the previous candle's high and its low below the previous low.

Which timeframe is best for engulfing candles?

The pattern is used on every timeframe. On the 1-hour, 4-hour and daily charts each candle carries more weight. Backtest the one you'll trade.

Where should the stop go on an engulfing trade?

Below the pattern's low for a bullish engulfing, with a small buffer. These rules use a quarter of the 14-period ATR below the lower of the two candles' lows.

Does the engulfing strategy work for gold?

The same rules apply on XAUUSD and the script runs on it unchanged. Gold's candles are bigger in dollars, so the stop and position size will look different; backtest it on your own dates.

More guides

All 75 guides →

हिंदी में पढ़ें: Lot size kaise nikale?, Prop firm challenge kaise pass kare?, Gold trading kaise kare?, Forex trading kya hai, और India में यह legal है या नहीं?

Trading psychology

The habits that decide whether a good strategy makes money.

All 14 trading psychology guides

8 popular prop firms

Well-known firms for forex, gold and index traders that were still operating in 2026. Compare their rules before you buy a challenge.

If a link in this list is a referral link, PipLedger may earn a commission if you sign up, at no extra cost to you. This list is not a recommendation. Programs, prices and rules change often, so check each firm's own site, including its margin and drawdown rules, before you buy a challenge.