In an uptrend (20 EMA above 50 EMA), buy a day that dips below the 20 EMA and closes back above it; sell when the close falls below the 50 EMA.
Backtest of Pullback to the 20 EMA on Nifty 50 from Dec 2005 to Nov 2026: CAGR 2.3%, max drawdown 31.8%, win rate 32.6% over 92 trades, vs buy-and-hold 11.0%.
As of · Hypothetical backtest by Jivani Markets on Nifty 50 daily data; re-run weekly
| Measure | Pullback to the 20 EMA | Buy and hold Nifty 50 |
|---|---|---|
| CAGR (annual return) | 2.3% | 11.0% |
| Total return | 60% | 783% |
| Max drawdown | −31.8% | −59.9% |
| ₹10 lakh became | ₹16 lakh | ₹88.3 lakh |
| Win rate | 32.6% | — |
| Trades (closed) | 92 | — |
| Winning / losing trades | 30 / 62 | — |
| Profit factor | 1.36 | — |
| Sharpe ratio | 0.28 | — |
| Volatility (annual) | 9.8% | — |
| Time in the market | 44% | 100% |
| Average holding | 25 sessions | — |
| Charges and slippage paid | ₹6,51,309 | — |
# Pullback to the 20 EMA on Nifty 50
universe("NIFTY 50", asset="index")
settings(
timeframe="1d",
entry_timing="next_open",
cost_model="retail",
slippage_model="tiered",
start="2006-01-01",
benchmark="NIFTY 50",
allow_short=False,
participation_ignore_zero_volume=True,
)
exit_when(close() < ema(50))
buy(all_of(ema(20) > ema(50), low() < ema(20), close() > ema(20)), size=percent_of_equity(100))
| Year | Strategy | Buy and hold |
|---|---|---|
| 2026* | −6.4% | −4.2% |
| 2025 | +3.3% | +10.5% |
| 2024 | +3.8% | +8.8% |
| 2023 | +3.4% | +20.0% |
| 2022 | −11.7% | +4.3% |
| 2021 | +8.0% | +24.1% |
| 2020 | +26.3% | +14.9% |
| 2019 | +0.2% | +12.0% |
| 2018 | +1.0% | +3.1% |
| 2017 | +6.2% | +28.6% |
| 2016 | +6.7% | +3.0% |
| 2015 | −7.5% | −4.1% |
| 2014 | +10.1% | +31.4% |
| 2013 | −1.3% | +6.8% |
| 2012 | −13.2% | +27.7% |
| 2011 | −9.9% | −24.6% |
| 2010 | +5.2% | +17.9% |
| 2009 | +7.8% | +75.8% |
| 2008 | −9.4% | −51.8% |
| 2007 | +5.3% | +54.8% |
| 2006 | +31.2% | +39.9% |
| Bought | At | Sold | At | Return |
|---|---|---|---|---|
| 26 Aug 2026 | 24,378.46 | 28 Aug 2026 | 24,086.42 | −1.4% |
| 13 Aug 2026 | 24,468.25 | 19 Aug 2026 | 24,115.82 | −1.7% |
| 14 Jul 2026 | 24,104.1 | 24 Jul 2026 | 23,630.85 | −2.2% |
| 7 Oct 2025 | 25,122.93 | 9 Jan 2026 | 25,801.64 | +2.5% |
| 25 Sept 2025 | 25,072.05 | 26 Sept 2025 | 24,781.32 | −1.4% |
| 12 May 2025 | 24,456.73 | 28 Jul 2025 | 24,745.28 | +1.0% |
| 6 Jun 2024 | 22,832.8 | 7 Oct 2024 | 25,046.47 | +9.5% |
| 17 May 2024 | 22,448.87 | 5 Jun 2024 | 22,095.16 | −1.8% |
| 23 Apr 2024 | 22,480.72 | 10 May 2024 | 21,957.96 | −2.5% |
| 26 Mar 2024 | 21,980.82 | 19 Apr 2024 | 21,828.71 | −0.9% |
From 30 Dec 2005 to 9 Nov 2026, these Pullback to the 20 EMA rules on the Nifty 50 index returned a CAGR of 2.3% after costs, less than the 11.0% a year from buying and holding the index, with a worst fall of 31.8% against 59.9% for buy-and-hold. It made 92 trades and was invested 44% of the time. This is a hypothetical test on past data, not a recommendation, and past performance is not indicative of future results.
32.6%: 30 of 92 closed trades made money after charges and slippage. On a ₹10 lakh account the average winning trade made ₹75,358 and the average losing trade lost ₹26,774; the profit factor (gross profit ÷ gross loss) was 1.36. A high win rate with small wins can still lose money, so read it with the CAGR and drawdown.
Buy: The 20-day EMA is above the 50-day EMA, the day's low is below the 20 EMA, and the close is back above it. Sell: The close falls below the 50-day EMA. One position at a time with all of the capital; out of the market (in cash, earning nothing) between trades. Daily candles, long only, orders filled at the next session's open.
Buying and holding the Nifty 50 index over the same dates returned 11.0% a year with a worst fall of 59.9%; the strategy returned 2.3% a year with a worst fall of 31.8%. A strategy that is out of the market part of the time usually gives up some return in rising years in exchange for missing part of the falls; the year-by-year table on this page shows where each one gained or lost.
Retail delivery charges (STT, exchange and SEBI fees, stamp duty and GST) and size-based slippage on every buy and sell; signals are read on the daily close and filled at the next session's open; price return only, so dividends are left out of both the strategy and buy-and-hold. An index cannot be bought directly; a fund or ETF that tracks it adds its own expense ratio and tracking error, and pays dividends this price-index test leaves out.
Yes. The "Run it yourself" link opens these exact rules in the Jivani Markets backtest builder, where you can change the indicator settings, add a stop-loss, pick other stocks or indices and re-run it on the latest data.