StrategyLab

20/50 EMA crossover

Be invested while the 20-day EMA is above the 50-day EMA. Step out when it crosses below.

Trend followingWeeks to monthsBeginnerTested on 10 stocks & indices

₹1 lakh in NIFTY50, Nov 2011 → Nov 2026

19 Nov 2011 → 19 Nov 2026
Buy & hold Best
₹5.33 L
XIRR 11.8% · Worst fall −38.4%
EMA 20/50 trend
₹4.43 L
XIRR 10.4% · Worst fall −18.6% · 25 trades, 60% won
₹0₹2L₹4L20112013201520172019202120232025
Money investedEMA 20/50 trendBuy & hold

The idea

Moving-average crossovers are the classic trend-following tool. The 20-day exponential average reacts fast, the 50-day slowly. When the fast line is above the slow one, the short-term trend is up, so you hold. No targets, no stop-loss: the crossover is the exit.

The rules

Buy
20-day EMA is above the 50-day EMA
Sell
20-day EMA falls below the 50-day EMA
Size
All capital; idle cash earns 6%
Prompt to paste in the Lab

₹1 lakh in NIFTY 50. Hold it while the 20-day EMA is above the 50-day EMA, sell when it crosses below. Idle cash earns 6%, 0.2% cost per trade. Compare with buy and hold over the last 15 years.

Test it in the Lab

Verdict across 10 stocks and indices

One stock can flatter any rule. The same rules on more names show whether it is an edge or luck.

0/10higher XIRR than buy & hold
10/10smaller worst fall

EMA 20/50 trend: on average 6.67 points a year worse than buy & hold on XIRR, with a worst fall 13.3 points smaller.

Stock / indexBuy & holdEMA 20/50 trendTradesWonTime in market
XIRRWorst fallXIRRWorst fall
NIFTY5011.8%−38.4%10.4%−18.6%2560%69%
BANKNIFTY14.2%−47.9%10.0%−21.6%3148%67%
RELIANCE15.3%−45.1%5.7%−41.7%4628%57%
HDFCBANK15.3%−41.1%7.9%−39.2%3543%67%
ICICIBANK19.3%−51.5%10.6%−36.4%3450%66%
TCS12.9%−53.4%2.3%−48.0%4134%64%
INFY11.1%−48.2%4.7%−36.1%3129%61%
SBIN15.2%−59.5%4.8%−47.2%3633%61%
ITC9.2%−55.3%8.8%−34.3%3333%57%
LT16.2%−54.4%8.5%−39.1%3333%65%

Each row is a separate backtest, 19 Nov 2011 → 19 Nov 2026. Green marks the best value in the row. Worst fall is the maximum drawdown: the largest drop from a peak in portfolio value.

Real trades, real dates

From the NIFTY50 backtest above: the median winner and loser. Exits are checked on closing prices, so a gap can push a loss past the stop-loss.

A typical winning trade

Bought NIFTY5026 Apr 2023at ₹17,813.6
184 days
Sold27 Oct 2023at ₹19,047.25

₹3,18,407 in → ₹3,39,097 out · +6.5% after costs

A typical losing trade

Bought NIFTY5010 Jan 2022at ₹18,003.3
30 days
Sold9 Feb 2022at ₹17,463.8

₹3,26,525 in → ₹3,15,475 out · −3.4% after costs

Last 8 trades
BoughtPriceSoldPriceDaysResult
3 Jul 2026₹24,270.857 Sep 2026₹23,779.1566−2.4%
15 Sep 2025₹25,069.221 Jan 2026₹25,157.5128−0.0%
22 Apr 2025₹24,167.258 Aug 2025₹24,363.3108+0.4%
21 Nov 2023₹19,783.425 Oct 2024₹24,180.8339+21.7%
26 Apr 2023₹17,813.627 Oct 2023₹19,047.25184+6.5%
19 Oct 2022₹17,512.2512 Jan 2023₹17,858.285+1.6%
26 Jul 2022₹16,483.8514 Oct 2022₹17,185.780+3.8%
4 Apr 2022₹18,053.44 May 2022₹16,677.630−8.0%

Tends to work

  • Long, smooth trends in indices
  • Bear markets: it steps aside and avoids the deepest part of a fall

Tends to fail

  • Sideways markets, where the lines cross back and forth (whipsaws)
  • V-shaped recoveries: it re-enters late, after much of the bounce

Make it yours

Click one to open it in the Lab, or write your own twist in plain English.

Assumptions and the exact spec the engine ran
  • ₹1,00,000 invested once; each trade uses all available cash
  • 0.2% cost on every buy and every sell (STT, brokerage, exchange charges, stamp duty)
  • Cash waiting between trades earns 6% a year, like a liquid fund
  • Prices are daily closes; indices are price indices (no dividends), stock prices include dividends
  • Taxes are not deducted
  • Signals are filled at the next day's close.
  • The stock list is today's, so stocks that were delisted or shrank are missing (survivorship bias).
{
  "title": "EMA 20/50 trend: NIFTY50",
  "years": 15,
  "cost_pct": 0.2,
  "assumptions": [
    "₹1,00,000 invested once; each trade uses all available cash",
    "0.2% cost on every buy and every sell (STT, brokerage, exchange charges, stamp duty)",
    "Cash waiting between trades earns 6% a year, like a liquid fund",
    "Prices are daily closes; indices are price indices (no dividends), stock prices include dividends",
    "Taxes are not deducted"
  ],
  "strategies": [
    {
      "name": "Buy & hold",
      "symbol": "NIFTY50",
      "contribution": {
        "amount": 100000,
        "every": "once"
      },
      "buy": {
        "when": "on_contribution"
      }
    },
    {
      "name": "EMA 20/50 trend",
      "symbol": "NIFTY50",
      "contribution": {
        "amount": 100000,
        "every": "once"
      },
      "cash_interest_pct": 6,
      "buy": {
        "when": "signal",
        "check": "daily",
        "condition": {
          "type": "ma_cross",
          "fast": 20,
          "slow": 50,
          "ma": "ema",
          "op": ">",
          "value": 0
        },
        "amount": "all_cash"
      },
      "sell": {
        "check": "daily",
        "condition": {
          "type": "ma_cross",
          "fast": 20,
          "slow": 50,
          "ma": "ema",
          "op": "<",
          "value": 0
        },
        "fraction": 1
      }
    }
  ]
}

Keep researching

All strategies