The rules at a glance
- Market: any major pair on the 1-hour chart; the example uses GBPUSD
- Trend: the 20 EMA is above the 50 EMA, and the 50 EMA is higher than it was 5 candles ago
- Pullback: a candle closes in the zone between the two averages: at or below the 20 EMA but above the 50 EMA
- Entry: the next candle, if it's bullish and closes back above the 20 EMA; enter at that close
- Stop loss: a quarter of an ATR below the lowest low of the last 5 candles; skip the trade if that's more than 3 × ATR away
- Target: twice the risk (2R)
- Shorts: the mirror image: the 20 EMA below a falling 50 EMA
What the two averages do
The 20 EMA follows the price closely; the 50 EMA moves more slowly. When the 20 is above the 50 and the 50 is rising, the market has been going up over both time frames. Price rarely moves in a straight line, though. It rises, dips, and rises again, and in a healthy uptrend the dips often stop somewhere between the two averages. Traders call that space the zone.
This strategy uses the zone as the entry. It doesn't buy when the trend starts, as a crossover does; it buys when an existing trend offers a better price. Compare it with the 9 and 21 EMA crossover, which trades the cross itself.
| Crossover | Pullback (this page) | |
|---|---|---|
| Buys when | The fast average crosses above the slow one | The price dips into the zone in an existing uptrend |
| Main risk | Buying late, after much of the move | Buying a dip that turns into a reversal |
| Stop | Below a recent swing | Below the pullback's low |
| Misses | Little, but enters late | Trends that never pull back |
The rules, step by step
1. Confirm the trend
On a 1-hour chart, the 20 EMA must be above the 50 EMA, and the 50 EMA must be higher than it was five candles ago. A flat 50 EMA means there's no trend to pull back in.
2. Wait for a candle to close in the zone
A candle must close at or below the 20 EMA but still above the 50 EMA. A close below the 50 EMA means the pullback has gone too deep; wait for the next setup.
3. Enter when the next candle closes back above the 20 EMA
If the next candle is bullish (close above open) and closes above the 20 EMA, buy at that close. Buyers have stepped back in.
4. Stop below the pullback, target 2R
The stop goes a quarter of the 14-period ATR below the lowest low of the last five candles, which covers the pullback. If that's more than three ATRs away, skip the trade. The target is twice the risk.
Worked example: GBPUSD, 1-hour chart
20 EMA 50 EMA
GBPUSD is climbing steadily, with the 20 EMA above a rising 50 EMA. Then it pulls back for four candles. The last one closes at 1.3497, below the 20 EMA (1.3507) but above the 50 EMA (1.3491): it's in the zone. The next candle is bullish and closes at 1.3513, back above the 20 EMA. The lowest low of the last five candles is 1.3494, and a quarter of the 8-pip ATR below it puts the stop at 1.3492.
| GBPUSD long | |
|---|---|
| Entry | 1.3513 |
| Stop loss | 1.3492, 21 pips away |
| Target (2R) | 1.3555, 42 pips away |
| Account and risk | $10,000, risking 1% = $100 |
| Lot size | $100 ÷ (21 pips × $10) = 0.476, rounded down to 0.47 lots |
| Loss if the stop is hit | $98.70 |
| Profit at the target | $197.40 |
The trend resumes and GBPUSD reaches the target 7 candles later. Not every pullback ends like this. Some keep falling through the 50 EMA after the entry and hit the stop, which is the risk of buying a dip.
Why 20 and 50?
There's nothing magic about the numbers. The 20 and 50 are popular because they're round and widely watched, and on the 1-hour chart they cover roughly the last day and the last two days of trading. Some traders use 21 and 55, or simple averages instead of exponential ones. The script lets you change both lengths; test any pair of settings on dates you didn't tune them on.
Risk management
- Size from the stop. Pullback stops on the 1-hour chart are often 15 to 30 pips on a major pair. Work it out every time with the lot size calculator.
- One trade at a time. A second pullback while the first trade is open isn't a reason to double the position.
- Avoid entries just before big news. A data release can turn a normal pullback into a reversal.
Common mistakes
- Buying the first touch of the 20 EMA. Wait for the close in the zone and the bullish close back above.
- Ignoring a flat 50 EMA. When the slow average goes flat, the market is ranging, and the zone stops working.
- Buying after a close below the 50 EMA. That's a deeper correction, not a pullback.
- Moving the stop up too early. Pullbacks often retest the low before the trend resumes.
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.
- Open the chart. On TradingView, open GBPUSD on the 1-hour chart.
- 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".
- 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.
- 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.
- Change one setting at a time. Compare 20/50 with 21/55 and 10/30, the slope check (3 to 10 candles), the stop look-back (3 to 8 candles) and the 2R target against 1.5R and 3R. Then try EURUSD, USDJPY 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, the zone, a worked example and a checklist, to keep next to your chart.
Show the code (Pine Script v6, 55 lines)
//@version=6
// 20 and 50 EMA Pullback strategy by PipLedger (https://pipledgerfx.com/20-50-ema-pullback-strategy)
// In an uptrend (20 EMA above a rising 50 EMA), waits for the price to pull back between the two averages, then buys the first bullish close back above the 20 EMA (sells the mirror image).
// Free to use and change. For education and backtesting only; not financial advice.
strategy("PipLedger: 20/50 EMA Pullback", shorttitle="EMA Pullback", 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
fastLen = input.int(20, "Fast EMA", minval=2)
slowLen = input.int(50, "Slow EMA", minval=5)
slopeBars = input.int(5, "Slow EMA must be higher (lower) than this many candles ago", minval=1)
swingBars = input.int(5, "Stop below the lowest low of the last (candles)", minval=2)
stopBuf = input.float(0.25, "Stop buffer (x ATR 14)", minval=0.0, step=0.05)
maxStopAtr = input.float(3.0, "Skip if the stop is further than (x ATR)", minval=0.5, step=0.25)
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
fast = ta.ema(close, fastLen)
slow = ta.ema(close, slowLen)
atr = ta.atr(14)
upTrend = fast > slow and slow > slow[slopeBars]
dnTrend = fast < slow and slow < slow[slopeBars]
// the previous candle closed in the zone between the averages; this one closes back beyond the fast EMA
longSig = upTrend and close[1] <= fast[1] and close[1] > slow[1] and close > fast and close > open
shortSig = dnTrend and close[1] >= fast[1] and close[1] < slow[1] and close < fast and close < open
longSl = ta.lowest(low, swingBars) - stopBuf * atr
shortSl = ta.highest(high, swingBars) + stopBuf * atr
flat = strategy.position_size == 0
// ---------- Orders
if flat and longSig and close - longSl <= maxStopAtr * atr
float q = calcQty(close, longSl)
if q > 0
strategy.entry("Long", strategy.long, qty=q)
strategy.exit("Long exit", "Long", stop=longSl, limit=close + (close - longSl) * rr)
if flat and shortSig and shortSl - close <= maxStopAtr * atr
float q = calcQty(close, shortSl)
if q > 0
strategy.entry("Short", strategy.short, qty=q)
strategy.exit("Short exit", "Short", stop=shortSl, limit=close - (shortSl - close) * rr)
// ---------- Chart
plot(fast, "20 EMA", color=color.new(color.teal, 0), linewidth=2)
plot(slow, "50 EMA", color=color.new(color.orange, 0), linewidth=2)
plotshape(longSig, "Long", shape.triangleup, location.belowbar, color.teal, size=size.small)
plotshape(shortSig, "Short", shape.triangledown, location.abovebar, color.red, size=size.small)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. On the exchange contracts one lot is £1,000 on GBPUSD, so a pip is worth $0.10 a lot; size the trade in exchange lots, not 100,000-unit lots. 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: ADX trend following, ATR trailing stop, EMA and RSI(2), RSI divergence, 9 and 21 EMA crossover, MACD and 200 EMA, RSI 60/40. All 34 strategies are compared on one page in forex trading strategies.