Algo trading lesson: 50/200-day moving average crossover backtest on Nifty Bank (data to 17 Nov 2026)
17 Nov 2026 · built from NSE and BSE data by Stocks Glance
We tested the 50/200-day moving average crossover on the Nifty Bank from 27 Oct 2016 to 17 Nov 2026: 4.30% a year against 12.29% for simply holding the index, with a worst fall of -43.73% against -47.86%.
The rule
Hold while the 50-day average is above the 200-day average (a 'golden cross'); exit when it falls below (a 'death cross'). The signal uses the closing price, and the position changes from the next day, so the test never uses information it could not have had.
Results on Nifty Bank (27 Oct 2016 to 17 Nov 2026)
| Measure | Strategy | Buy and hold |
|---|---|---|
| Annual return (CAGR) | 4.30% | 12.29% |
| Worst fall from a peak (max drawdown) | -43.73% | -47.86% |
| ₹1 lakh became | ₹1,52,434.19 | ₹3,19,111.08 |
| Time invested | 77.92% | 100% |
| Number of trades | 8 | 1 |
| Trades that made money | 50.00% | — |
Year by year
| Year | Strategy | Buy and hold |
|---|---|---|
| 2016 | -6.85% | -6.85% |
| 2017 | +40.50% | +40.50% |
| 2018 | -2.04% | +6.35% |
| 2019 | +2.43% | +18.41% |
| 2020 | -22.37% | -2.79% |
| 2021 | +13.49% | +13.49% |
| 2022 | +11.46% | +21.15% |
| 2023 | +12.34% | +12.34% |
| 2024 | +5.32% | +5.32% |
| 2025 | +8.08% | +17.15% |
| 2026 | -7.55% | +4.52% |
What this test leaves out
- Costs: no brokerage, STT, exchange charges, GST, stamp duty or slippage. Rules that trade often lose more to costs than this table shows.
- Taxes: every exit can create a short-term capital gain.
- Index, not a fund: you cannot buy the index itself; index funds and ETFs track it with small errors and charge fees.
- Dividends: the price index excludes dividends, which slightly understates buy and hold.
- Hindsight: a rule chosen after looking at the past tends to look better than it will in future. This is called overfitting.
How algo trading works in India
Retail investors run rule-based strategies through their broker's platform or API, under rules set by SEBI. A backtest like this one is the first step a quant researcher takes, not proof that a strategy works. Learn the building blocks in trends and moving averages, RSI explained and risk management and stop-loss.