StrategyLab

The 200 DMA switch

Own the index above its 200-day average. Sit in a liquid fund when it closes 2% below.

Trend followingMonthsBeginnerTested 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%
200 DMA switch
₹3.15 L
XIRR 7.9% · Worst fall −19.3% · 20 trades, 40% won
₹0₹2L₹4L20112013201520172019202120232025
Money invested200 DMA switchBuy & hold

The idea

The 200-day moving average (200 DMA) is the line every Indian market show talks about. This rule uses it as an on/off switch: invested above it, in cash below it. The 2% buffer avoids flipping every time the price touches the line.

The rules

Buy
Close is above the 200-day simple moving average
Sell
Close is 2% or more below the 200-day average
Size
All capital; idle cash earns 6%
Prompt to paste in the Lab

₹1 lakh in NIFTY 50. Buy when it closes above its 200-day average, sell when it closes 2% below it. Idle cash earns 6%, 0.2% cost per trade. Compare with buy and hold, 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.

1/10higher XIRR than buy & hold
9/10smaller worst fall

200 DMA switch: on average 5.85 points a year worse than buy & hold on XIRR, with a worst fall 13.1 points smaller.

Stock / indexBuy & hold200 DMA switchTradesWonTime in market
XIRRWorst fallXIRRWorst fall
NIFTY5011.8%−38.4%7.9%−19.3%2040%79%
BANKNIFTY14.2%−47.9%7.6%−30.4%3037%76%
RELIANCE15.3%−45.1%5.3%−47.7%3438%74%
HDFCBANK15.3%−41.1%8.7%−39.5%3027%79%
ICICIBANK19.3%−51.5%10.5%−31.9%3324%75%
TCS12.9%−53.4%9.7%−30.6%2924%75%
INFY11.1%−48.2%3.4%−41.8%3523%62%
SBIN15.2%−59.5%7.6%−50.5%3234%68%
ITC9.2%−55.3%9.8%−35.0%2829%65%
LT16.2%−54.4%11.5%−36.7%2528%72%

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 NIFTY506 Jan 2017at ₹8,243.8
640 days
Sold8 Oct 2018at ₹10,348.05

₹1,28,661 in → ₹1,60,857 out · +25.0% after costs

A typical losing trade

Bought NIFTY501 Dec 2016at ₹8,192.9
22 days
Sold23 Dec 2016at ₹7,985.75

₹1,32,232 in → ₹1,28,374 out · −2.9% after costs

Last 8 trades
BoughtPriceSoldPriceDaysResult
22 Apr 2025₹24,167.255 Mar 2026₹24,765.9317+2.1%
6 Apr 2023₹17,599.1513 Jan 2025₹23,085.95648+30.7%
1 Aug 2022₹17,340.0515 Mar 2023₹16,972.15226−2.5%
21 Mar 2022₹17,117.65 May 2022₹16,682.6545−2.9%
20 Jul 2020₹11,022.225 Feb 2022₹16,658.4585+50.5%
23 Sep 2019₹11,600.22 Mar 2020₹11,132.75161−4.4%
26 Feb 2019₹10,835.36 Aug 2019₹10,948.25161+0.6%
14 Dec 2018₹10,805.4519 Feb 2019₹10,604.3567−2.3%

Tends to work

  • Long bear markets: keeps losses smaller
  • Investors who cannot sit through a 35% fall

Tends to fail

  • Choppy years around the average: many small losing trades
  • Strong recoveries: it buys back higher than it sold

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": "200 DMA switch: 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": "200 DMA switch",
      "symbol": "NIFTY50",
      "contribution": {
        "amount": 100000,
        "every": "once"
      },
      "cash_interest_pct": 6,
      "buy": {
        "when": "signal",
        "check": "daily",
        "condition": {
          "type": "vs_sma",
          "days": 200,
          "op": ">",
          "value": 0
        },
        "amount": "all_cash"
      },
      "sell": {
        "check": "daily",
        "condition": {
          "type": "vs_sma",
          "days": 200,
          "op": "<",
          "value": -0.02
        },
        "fraction": 1
      }
    }
  ]
}

Keep researching

All strategies