Guide

How to Backtest Indian Stocks Without Fooling Yourself

By Fincrux Data Team · Updated 26 November 2026 · 10 min read

A backtest is a test of a rule on history, not a prediction. Most bad backtests are not caused by a weak strategy. They are caused by data that was not available, costs that were left out, or a universe that quietly used today's winners. Fix those first.

How to Backtest Indian Stocks Without Fooling Yourself

Start with the data, not the signal

Indian equities have splits, bonuses, dividends, symbol changes and companies that stop trading. A price series that ignores those events creates returns that never existed. Use adjusted prices for returns, but keep the raw price and the adjustment factors so you can reproduce the calculation.

  • Check the first and last trading date for every symbol.
  • Confirm that a missing day is a holiday, a suspension or a data gap.
  • Keep the exchange series, not just the normal equity series.
  • Record the timestamp and source of every dataset.

Avoid survivorship bias

If your universe is today's Nifty 50, every company that was removed from the index is missing from the test. That makes the strategy look better than it was. Use the index membership, or the full listed universe, as it existed on the test date. If the historical membership is unavailable, state the bias in the results instead of hiding it.

Remove look-ahead bias

Look-ahead is any information that was not available at the moment the decision was made. The two common forms are price look-ahead and fundamental look-ahead.

  • Signal on a closed candle and execute on the next bar.
  • Shift indicators by one bar when the test fills at the next open.
  • Join quarterly results by publication date, not period end.
  • Do not use the day's high or low to trigger an entry that could not be known in advance.
signals = (fast_ma > slow_ma).astype(int)
signals = signals.shift(1).fillna(0)  # decide today, trade next bar

Costs are part of the strategy

Include brokerage, exchange transaction charges, STT, GST, stamp duty and slippage on every side. Keep them in the result even when they make the equity curve less exciting. For a high-turnover strategy, costs can consume most of the gross edge.

Slippage is not a constant. It is larger in illiquid stocks, around news, and when an order is large relative to the visible depth. If you cannot estimate it, test a pessimistic range instead of zero.

Report more than total return

  • CAGR and total return, net of costs.
  • Maximum drawdown and the time spent underwater.
  • Sharpe or Sortino, with the risk-free assumption stated.
  • Profit factor, win rate and average win/loss.
  • Turnover, exposure and the number of trades.
  • Results by year and by market regime.

A high return with a drawdown you would not sit through is not a usable result. The equity curve matters as much as the final number.

Validate on data you did not optimise on

Keep a final period untouched while you tune the rules. Better still, use walk-forward testing: optimise on one window, test on the next, roll forward and repeat. If neighbouring parameter values produce wildly different results, the strategy is probably fitting noise.

Indian market details that break tests

  • Circuit limits can prevent the fill your backtest assumes.
  • Freeze quantities split large orders into multiple orders.
  • Intraday positions are squared off by the broker before the close.
  • Corporate actions change the number of shares and the price.
  • Liquidity is not uniform across large caps, mid caps and small caps.

This guide is educational and is not investment advice. Past results do not predict future returns. A backtest is a tool for rejecting bad ideas, not a guarantee that a strategy will work.

Frequently asked questions

Which data do I need to backtest Indian stocks?

At minimum: adjusted daily OHLCV prices, the trading calendar, corporate actions and a universe that reflects the period being tested. For fundamental strategies you also need the publication date of each result, not just the period it covers.

Should I use adjusted or unadjusted prices?

Use adjusted prices for return calculations so splits and bonuses do not create fake jumps. Keep the raw prices and the adjustment factors as well, because execution, circuit limits and some corporate-action calculations need the actual traded price.

How do I avoid look-ahead bias?

Use only information that was available at the decision time. Signal on a closed candle and execute on the next bar, join fundamental data by publication date, and avoid using the final index membership of today to build a universe for 2018.

What costs should a backtest include?

Brokerage, exchange charges, STT, GST, stamp duty and slippage. Model them per side and keep them visible. A strategy that only works with zero costs is not a strategy yet.

How many trades are enough?

There is no universal number, but a handful of trades is not evidence. Aim for enough trades to see different market conditions, then validate the rules on a period you did not use for parameter selection.

Keep exploring

Put this guide to work

Start free with the Hobby plan, then scale when your product needs more throughput.

Start free