How to Backtest Trading Strategies

Backtesting a trading strategy means testing its rules against historical market data to see how it would have performed — before you risk real money. Done well, it is the closest thing traders have to a controlled experiment. Done badly, it produces confident nonsense. This guide covers how to backtest trading strategies properly, the metrics that actually matter, the mistakes that fool most people — and 15 real backtests we ran on NIFTY and BANKNIFTY so you can see each idea in action.

What is backtesting?

Backtesting in trading is the process of applying a set of trading rules to past price data and recording the results as if you had traded them at the time. If your rule is “buy NIFTY when the 20-day average crosses above the 50-day average,” a backtest walks through history, takes every signal that rule would have fired, and tallies the profit, loss and risk along the way. The output is not a prediction — it is evidence about whether an idea has any edge, and what it costs you to hold.

Why backtest before you trade

  • It separates ideas that work from ideas that just sound good.
  • It reveals the drawdown you would have to sit through — the number that actually blows up accounts.
  • It lets you compare variants objectively — entry times, stops, strikes — instead of by gut feel.
  • It builds the conviction to stick with a strategy through its inevitable rough patch.
The point isn't the return — it's the drawdown
Most strategies that “work” still hand you a stretch of losses that would make you quit at the worst possible moment. A good backtest tells you what that stretch looks like before it happens to your money.

How to backtest a trading strategy, step by step

  • 1. Define the rules precisely. Entry, exit, position size and stop, with no ambiguity. “Buy the dip” is not a rule; “buy at the close of any day NIFTY falls more than 1%, exit next close” is.
  • 2. Use quality historical data. Clean, and granular enough for your strategy — minute-level (and the full option chain) for intraday and options strategies, daily for swing systems.
  • 3. Run it over a meaningful sample. Enough trades to be statistically real, and across different market regimes — trending and range-bound. A single bull year flatters everything.
  • 4. Measure the right metrics. Not just the return (see below).
  • 5. Stress-test the parameters. Vary the entry time, the stop, the strike. If the result collapses when you nudge a setting, it was overfit to the past, not a real edge.

The metrics that matter (and the one that lies)

A single return number tells you almost nothing. Judge a strategy on the full picture:

  • Win rate — how often you win. Necessary, but deeply misleading on its own.
  • Average win vs average loss — the asymmetry that actually decides profitability.
  • Net P&L — the bottom line in points or rupees, after costs.
  • Maximum drawdown — the worst peak-to-trough fall. The survival number.
  • Sharpe ratio — return per unit of risk; how smooth the ride is.
  • Equity curve — the shape. A smooth climb and a jagged one can share the same endpoint and be completely different strategies to live with.
Win rate lies
We backtested a NIFTY breakout that won 53% of its trades and still lost money — because its losses were bigger than its wins. A high win rate with poor win/loss asymmetry is a losing strategy in disguise. (It is one of the studies below.)

The mistakes that fool most backtesters

  • Overfitting (curve-fitting). Tuning a strategy until it fits the past perfectly — it then fails live. The more knobs you turn, the more suspicious a great result should make you.
  • Look-ahead bias. Using information the trade would not have had at the time — like using the day's closing price to decide a morning entry.
  • Survivorship bias. Testing only on instruments or periods that happened to survive, quietly ignoring the ones that didn't.
  • Ignoring costs and slippage. Brokerage, taxes and the gap between the price you see and the price you get. A strategy that churns thousands of trades can be wiped out by costs alone.
  • Too-short a sample. A strategy that only ever saw a bull market has not been tested — it has been flattered.
  • Idealized fills. Assuming a stop fills exactly at its level. We made this exact mistake testing a straddle stop-loss — a perfect-fill assumption made the stop look great; using realistic fills flipped the conclusion entirely.

15 real backtests to learn from

Every principle above is easier to see in a real example. Here are the studies we have run — each a complete, honest backtest on NIFTY or BANKNIFTY, with the equity curve and the caveats spelled out:

Myth-busting

Option selling

Intraday

Greeks

Trend following

Comparison

Seasonality

Backtesting on Indiquant

Indiquant lets you backtest trading strategies on NIFTY and BANKNIFTY — spot, futures and options — by describing them in plain English. No code, no data wrangling. You get win rate, drawdown, Sharpe and the full equity curve in seconds, so you can judge an idea honestly instead of hoping.

Indiquant is in invite-only alpha. Register your interest to start backtesting your own strategies on real Indian-market data.

Register for alpha access Options backtesting →

Frequently asked questions

What does it mean to backtest a trading strategy?

Backtesting a trading strategy means applying its exact rules to historical market data and recording the results as if you had traded them at the time. It estimates how a strategy would have performed — its returns, win rate and drawdown — before you risk real money.

What data do I need to backtest a strategy?

You need clean historical price data at the right granularity for your strategy — daily data for swing strategies, and minute-level data (including the option chain, for options strategies) for intraday ones. The data should cover a period long enough to include different market conditions.

How much historical data is enough for a backtest?

Enough to include both trending and range-bound markets and produce a meaningful number of trades — usually at least a couple of years, and ideally across more than one market regime. A strategy tested only in a bull market hasn't been tested; it's been flattered.

Why do backtested strategies fail in live trading?

The usual culprits are overfitting (tuning a strategy until it fits the past perfectly), ignoring costs and slippage, look-ahead bias, and too-short a sample. A backtest that looks perfect is often a warning sign, not a green light.

Can I backtest trading strategies without coding?

Yes. Indiquant lets you describe a strategy in plain English and backtest it on NIFTY and BANKNIFTY — spot, futures and options — with no programming required.