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 Sensex from Dec 2005 to Nov 2026: CAGR 1.0%, max drawdown 36.0%, win rate 30.2% over 96 trades, vs buy-and-hold 10.9%.
As of · Hypothetical backtest by Jivani Markets on Sensex daily data; re-run weekly
| Measure | Pullback to the 20 EMA | Buy and hold Sensex |
|---|---|---|
| CAGR (annual return) | 1.0% | 10.9% |
| Total return | 23% | 764% |
| Max drawdown | −36.0% | −60.9% |
| ₹10 lakh became | ₹12.3 lakh | ₹86.4 lakh |
| Win rate | 30.2% | — |
| Trades (closed) | 96 | — |
| Winning / losing trades | 29 / 67 | — |
| Profit factor | 1.14 | — |
| Sharpe ratio | 0.15 | — |
| Volatility (annual) | 9.4% | — |
| Time in the market | 42% | 100% |
| Average holding | 23 sessions | — |
| Charges and slippage paid | ₹5,83,329 | — |
# Pullback to the 20 EMA on Sensex
universe("SENSEX", asset="index")
settings(
timeframe="1d",
entry_timing="next_open",
cost_model="retail",
slippage_model="tiered",
start="2006-01-01",
benchmark="SENSEX",
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* | −4.4% | −4.8% |
| 2025 | +0.2% | +9.1% |
| 2024 | −3.1% | +8.2% |
| 2023 | +1.5% | +18.7% |
| 2022 | −4.0% | +4.4% |
| 2021 | +4.2% | +22.0% |
| 2020 | +13.2% | +15.8% |
| 2019 | +3.9% | +14.4% |
| 2018 | +3.8% | +5.9% |
| 2017 | +7.4% | +27.9% |
| 2016 | +1.3% | +1.9% |
| 2015 | −12.3% | −5.0% |
| 2014 | +12.4% | +29.9% |
| 2013 | −4.7% | +9.0% |
| 2012 | −17.1% | +25.7% |
| 2011 | −8.6% | −24.6% |
| 2010 | +3.6% | +17.4% |
| 2009 | +4.4% | +81.0% |
| 2008 | −9.9% | −52.5% |
| 2007 | +5.2% | +47.1% |
| 2006 | +34.4% | +46.8% |
| Bought | At | Sold | At | Return |
|---|---|---|---|---|
| 13 Aug 2026 | 78,229.07 | 19 Aug 2026 | 77,102.22 | −1.7% |
| 14 Jul 2026 | 77,388.25 | 23 Jul 2026 | 76,400.33 | −1.5% |
| 11 Nov 2025 | 83,797.03 | 9 Jan 2026 | 83,896.06 | −0.1% |
| 24 Jul 2025 | 82,904.12 | 28 Jul 2025 | 81,178.02 | −2.3% |
| 12 May 2025 | 80,925 | 21 Jul 2025 | 81,795.65 | +0.8% |
| 16 Dec 2024 | 82,123.31 | 19 Dec 2024 | 78,910.49 | −4.1% |
| 19 Aug 2024 | 80,801.27 | 7 Oct 2024 | 81,804.1 | +1.0% |
| 6 Jun 2024 | 75,191.32 | 7 Aug 2024 | 79,446.05 | +5.4% |
| 17 May 2024 | 73,821.88 | 5 Jun 2024 | 72,918.34 | −1.4% |
| 23 Apr 2024 | 74,160.01 | 10 May 2024 | 72,366.74 | −2.6% |
From 30 Dec 2005 to 9 Nov 2026, these Pullback to the 20 EMA rules on the Sensex index returned a CAGR of 1.0% after costs, less than the 10.9% a year from buying and holding the index, with a worst fall of 36.0% against 60.9% for buy-and-hold. It made 96 trades and was invested 42% of the time. This is a hypothetical test on past data, not a recommendation, and past performance is not indicative of future results.
30.2%: 29 of 96 closed trades made money after charges and slippage. On a ₹10 lakh account the average winning trade made ₹62,109 and the average losing trade lost ₹23,497; the profit factor (gross profit ÷ gross loss) was 1.14. 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 Sensex index over the same dates returned 10.9% a year with a worst fall of 60.9%; the strategy returned 1.0% a year with a worst fall of 36.0%. 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.