Monday 30 Mar 2026. Nifty closed at 22,331.40, 15.2% under its close of 26,328.55 on 2 Jan. A backtest run today sees that whole fall. A trader on 2 Feb 2026 saw none of what came after. The gap between what the test knows and what the trader knew is where most backtests go wrong. A backtest replays a rule on past data to see what it would have done. It tests a hypothesis and forecasts nothing, and each of the five biases below makes the answer look better than it was. This lesson names them, shows three on dated NSE data and says how to guard against each. Nothing here is a strategy to run, and nothing is a view on where Nifty goes.
3By the end you can
- Say what a backtest can and cannot show, and how to run a free end of day one on NSE files.
- Name the five biases: look ahead, survivorship, overfitting, cost and fill, sample and regime.
- Price a trade at the STT rate of its own date, and read the result of a test with that in mind.

The idea, plainly
What is a backtest?
Write the rule first, in plain words: what it trades, when it enters, how much it risks and when it exits. Feed it the data as it stood on each date, record every trade with its costs, and total the result. A backtest can disprove a rule cheaply. It can rarely prove one, because the past is one path and the person running the test already knows how it ended. The biases are the ways that knowledge leaks in. How to measure the result is the subject of strategy metrics.
Each stage of a backtest has its own bias
How do I backtest an option strategy for free in India, or in Python?
NSE publishes its end of day F&O files, with each contract's settlement price, volume and open interest, on its reports page at no charge. A short Python script reads one day's file, rebuilds the option chain and applies the rule, and a loop runs it over dates. The free files cannot give the intraday price or the bid and ask, so every fill in such a test is a settlement or a close. That limit is bias four below. Keep three things beside the code: the date of each file, the rule as written before the first run, and a table of costs by date.
What is look ahead bias?
It is using information that did not exist when the trade would have been placed. The classic form is a rule that reads the day's close and trades at that same close. End of day files appear only after the market shuts, so a rule that reads a day's open interest can trade no earlier than the next session. The high and low of the day, final settlement figures and revised data are off limits too. The guard is mechanical: lag every input by one bar and check the timestamp of each. A result that looks too good often fails this check first.
What is survivorship bias?
It is testing only what still exists. Today's list of stocks with futures and options leaves out those that dropped out, so a test on it flatters any rule that picks stocks. SEBI revised the entry and exit criteria for stock derivatives in Aug 2024, so the list moves. Contracts end as well: the BANKNIFTY weekly contracts expired for the last time on 13 Nov 2024, and no later file holds one. A test must use the list and the contracts as they stood on each date, and say what it did with those that vanished.
The term this section turns on: Survivorship bias
What are overfitting and data snooping?
Overfitting fits the rule to the noise of one sample. Try many versions of a rule on the same data and one will look good by luck. If twenty useless rules are each tested at the usual five percent level, the chance that at least one looks significant is 64.2 percent when the tests are independent. The chart shows how fast it climbs: 5.0 percent for one rule, 22.6 for five, 40.1 for ten and 92.3 for fifty. The guards: write the rule before testing, count every version tried and not only the winner, keep a stretch of data the rule never saw, and ask whether it has a reason to work.
Test enough rules and one will pass by luck
Must a backtest include STT and costs?
Yes, by date, and the costs are more than STT. STT is charged on the premium of a sold option, the exchange charges a fee on every trade, SEBI takes a turnover fee and GST sits on the exchange charge. Brokerage and slippage come on top. The rates change. STT on a sold option's premium was 0.0625% from 1 Apr 2023, 0.10% from 1 Oct 2024 and 0.15% from 1 Apr 2026. A test that spans those dates with one rate misprices every trade. At the three rates the STT on one sale is Rs 5.29, Rs 8.47 and Rs 12.70, as the chart shows.
The same sale paid more STT at each rate change
Read one more paragraph, 42 words
SEBI's August 2026 study of FY26 shows what is at stake in aggregate. Among individual traders, 87.7% made a net loss after costs and 82.1% before them, and transaction costs ran to about Rs 25,000 crore a year in FY25 and FY26.
What are sample bias and regime bias?
A window with one crash holds one lesson, and a window with none holds none. The 20 day realised volatility of Nifty ran from 5.2% to 29.5% within the 300 sessions in the files. The rules change as well. The Nifty lot was 75 units in mid 2025 and 65 from January 2026. The Nifty expiry moved from Thursday to Tuesday on 1 Sep 2025. From 7 Dec 2026 the expiry settlement price becomes a volume weighted average over the last thirty minutes of trading, and for expiries before that date it is the index close. A test must carry the rule in force on each date.
One rule meets calm and stormy months, not one market
Model, not market data
A short sample of a seller shows the wins and misses the tail
Read one more paragraph, 60 words
A seller of far options is the sharpest case. In a model with fair prices, the seller of a far Nifty put wins 19 weeks in 20, and the tail week that gives it all back is expected only 0.7 times in that window. A typical sample of that length meets none, so its record looks like steady gains.
Worked example: one sold put, two sets of rates
Take the Nifty 24,000 put of the March expiry on 2 Feb 2026, settled at 130.25 a unit. One lot of 65 units sold at that price brings in Rs 8,466. A test that fills at the settlement price books exactly that. The table prices the statutory charges of the sale at the rates in force that day and at the rates from 1 Apr 2026.
| One sold lot, rupees | Rates of Oct 2024 | Rates from Apr 2026 |
|---|---|---|
| STT on the premium | 8.47 | 12.70 |
| Exchange charge | 2.97 | 3.01 |
| SEBI turnover fee | 0.01 | 0.01 |
| GST on the exchange charge | 0.53 | 0.54 |
| Statutory total | 11.97 | 16.26 |
| Share of the premium | 0.14% | 0.19% |
Read one more paragraph, 110 words
The total rose 35.8% across the two columns, yet it stays a small share of the premium, 0.19%, for a trade held to expiry. Brokerage and slippage are larger. An assumed slippage of one rupee a unit costs Rs 65.00 on one lot, 4.0 times the statutory total at the new rates. The fill is the largest assumption of all. A strike that traded a handful of contracts gets a settlement price that is not the price of a trade, so a test that fills there trades at a price that never stood as an order. The cost lesson is in the real cost of an F&O trade.
The common mistake
The belief: My backtest looks great, so the strategy works.
Run it through the five stages. Did the signal use anything unknown at the time? Does the list of stocks or contracts include what has vanished? How many versions were tried before this one, given that twenty are enough for a lucky pass in 64.2 percent of cases? Were the costs those of each date, and was the fill a trade or a settlement? Did the window hold more than one regime? A good curve that passes all five is a reason to test further, on data the rule has not seen. SEBI now allows only registered advisers, research analysts and empanelled algo providers to state past performance, and only as risk and return figures verified by a recognised agency, operating since 4 May 2026. A backtest on a screenshot is not that.

Key takeaways
- A backtest tests a hypothesis. It does not forecast anything.
- Look ahead bias is a timing error: lag every input by one bar.
- Test the list and the contracts as they stood on each date.
- Count every version tried. Enough useless rules will pass by luck.
- Costs have rates by date, and a settlement price is not a fill.
- A window with no crash tells nothing about crashes.
Two terms to hold on to from 19.1
Before you trade. Derivatives trading carries a high risk of loss. SEBI's study "Profitability of Individual Traders in the Equity Derivatives Segment (FY25 to FY26)" (August 2026) found that 87.7% of individual traders in equity F&O made net losses in FY26, with aggregate net losses of Rs 91,685 crore. Read the SEBI study