Strategies

What is Backtesting?

Reviewed by Karthikeyan Anbarasan (Founder, TradeLyser) · Updated 19 Oct 2026 · Editorial policy

DefinitionBacktesting is running a strategy’s rules over past market data to see how they would have performed. An illustrative backtest of 120 Nifty option trades showing +₹78,000 gross drops to +₹61,800 once charges and slippage are included, and it still has to hold up on data the rules were not built on.
0%50%100%10 trades±31 pts30 trades±18 pts100 trades±10 pts300 trades±6 pts
Figure 1. The 95% range around a measured 50% win rate after 10, 30, 100 and 300 trades: about ±31, ±18, ±10 and ±6 points. A backtest with few trades cannot separate an edge from luck.

How to run a backtest

  1. Write the rules so that two people would take the same trades: the trigger, the stop, the target or exit, the size and the hours.
  2. Choose data that matches the trade: intraday candles for an intraday setup, option prices per strike and expiry for an option strategy.
  3. Cover different conditions, such as trending, ranging and high-volatility periods, not just the last good stretch.
  4. Record every simulated trade with its entry time, price, exit and result, exactly as you would in a live journal.
  5. Apply charges and slippage to each trade, then work out expectancy, win rate, profit factor and max drawdown.

Biases that flatter a backtest

Look-ahead bias

Using information that was not available at the time, such as the day’s close to decide a 10:00 entry, or a signal that is only confirmed when the bar closes.
Fix: act only on completed bars

Survivorship bias

Testing only on stocks that are listed, or in an index, today, which leaves out the ones that were delisted or dropped after falling.
Fix: use the members as they were at the time

Overfitting

Tuning parameters until the past looks perfect. Enough tweaks on the same data will find something that worked by chance.
Fix: hold back data for an out-of-sample test

Costs a backtest must include

CostHow it applies (NSE, from 1 April 2026)
STTOptions: 0.15% of the sell-side premium. Futures: 0.05% of the sell side
Exchange chargesOptions 0.03553% of premium; futures 0.00183% of turnover
Brokerage and GSTYour broker’s rate per order, plus 18% GST on brokerage and exchange charges
Stamp dutyBuy side only: options 0.003%, futures 0.002%
SlippageThe gap between the signal price and a realistic fill; larger on fast moves and thin strikes

Illustrative: a strategy averaging +₹650 per trade gross over 120 trades shows +₹78,000. With ₹80 of charges and ₹55 of slippage per trade, it makes +₹515 per trade, or +₹61,800 in total.

Gross, 120 trades
+₹78,000
Charges + slippage per trade
−₹135
Net per trade
+₹515
Net, 120 trades
+₹61,800

Reading the results

MetricSame backtest, net (illustrative)What to ask
Trades120Enough to judge? Under 30 is a rough read only
Win rate50% (60 wins, 60 losses)Does it hold in each year, or come from one period?
Average win / average loss₹2,530 / ₹1,500Is the payoff realistic for the stops and targets used?
Expectancy+₹515 per tradeStill positive after charges and slippage?
Profit factor₹1,51,800 ÷ ₹90,000 = 1.69Does it fall sharply out of sample?

Check the arithmetic both ways: 60 × ₹2,530 = ₹1,51,800 won and 60 × ₹1,500 = ₹90,000 lost gives +₹61,800, which matches 120 × ₹515. Also look at the worst losing streak and the max drawdown against your daily and weekly limits; a strategy that would have broken your loss limits in the test will break them live.

Testing out of sample

  1. Split the history before you start: build the rules on the earlier part, for example the first two years, and set the last year aside.
  2. Fix the rules and parameters, then run them once on the held-back year.
  3. Compare expectancy, win rate and max drawdown between the two periods. A large drop suggests the rules were fitted to the first period.
  4. Paper trade or trade small size live, and journal those trades under the same strategy tag so they can be compared with the backtest.

Backtest

Rules run over past data. Fast and repeatable, but fills and your own hesitation are assumptions.
Answers: did the rules have an edge?

Paper or forward test

Rules run in the live market without real money. Shows missed entries and hesitation, not real fills.
Answers: can I follow the rules in real time?

Small live size

Real orders at minimum size, journalled under the same tag. The first test of real fills and charges.
Answers: does the edge survive execution?
Common mistakes
Testing only a strong bull run; assuming fills at the candle close on far out-of-the-money strikes that barely trade; changing the rules after seeing the out-of-sample result and calling the new run out of sample; and leaving charges out of a strategy that trades many times a day.
For F&O traders in India
Contract rules have changed over time: NSE moved expiries from Thursday to Tuesday in September 2025, Bank Nifty and FinNifty weekly contracts ended in November 2024, and lot sizes are revised periodically. Check that a backtest uses the rules of each period. TradeLyser’s backtesting replays historical NSE data candle by candle, including options, and records simulated trades in the journal so they can be compared with live results.

Reference guide

ContextValueReading
Tested on data it was not tuned onMore dependableOut-of-sample results close to in-sample suggest the rules are not just fitted to the past
Fewer than 30 tradesToo small to judgeAfter 30 trades a 50% win rate still has a range of about ±18 points
Gross P&L onlyOverstatedAdd brokerage, STT, exchange charges, GST, stamp duty and slippage before trusting it

Questions

Is backtesting reliable?

Only as reliable as the data, the cost assumptions and the number of trades. A backtest that includes charges and slippage, avoids look-ahead bias and holds up out of sample is a reasonable starting point, not a promise of live results.

How many trades does a backtest need?

At least 30 for a rough read, and closer to 100 or more before trusting the numbers. With 30 trades, a 50% win rate still has a range of about ±18 points.

What is the difference between backtesting and paper trading?

Backtesting runs rules over past data; paper trading runs them in the live market without real money. Paper trading catches things a backtest misses, such as hesitation and missed entries, but neither shows your real fills.

Should a backtest include STT and brokerage?

Yes. From 1 April 2026, STT is 0.15% of the sell-side premium on options and 0.05% of the sell side on futures, before brokerage, exchange charges, GST and stamp duty. On frequent intraday strategies, these can decide whether the result is positive.

Can I backtest options strategies in India?

Yes, but it needs historical prices for each strike and expiry, not just the index. Check that the data follows the contract rules of each period, such as expiry days and lot sizes, and assume worse fills on strikes that trade thinly.

What is a good backtest result?

There is no single number. Look for positive expectancy after charges and slippage over 100 or more trades, a drawdown your limits could survive, and out-of-sample results that stay reasonably close to the in-sample ones.

Related terms