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 biases below makes the answer look better than it was. This lesson names them, shows them 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 biases: look ahead, survivorship, overfitting, cost and fill, sample and regime, and size the luck in the best of N rules.
- Price a trade at the STT rate of its own date, include STT on exercise, and treat the fill as a band, not a point.

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, and the options specific version of the whole exercise is in backtesting options.
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 on its reports page at no charge. Each contract carries its open, high, low, close, settlement price, volume and open interest. 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 hold no quotes, so every fill in such a test is a settlement or a close, and that limit drives 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 and rules 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.
Read one more paragraph, 150 words
Options add three quieter forms. First, the settlement price of a future is built from trading in the last half hour, so a rule that "enters at the settlement price" after reading the close has bought a print it could not have seen. Second, implied volatility computed from settlement prices uses prices that are published after the close, so a rule that trades at 15:25 on that volatility is a step ahead of the market. Third, the strikes that traded: a strike that had no trade on the day still has a settlement price in the file, and a test that picks strikes by volume or open interest at the close and trades them earlier in the same day has used the future. 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 SEBI circular of 1 Oct 2024 limited each exchange to weekly contracts on one benchmark index from 20 Nov 2024, so the weeklies on the other NSE indices stopped. The bank index weeklies expired for the last time on 13 Nov 2024, and no later file holds one. SEBI's circular of 26 May 2025 limited expiries of all equity derivatives to Tuesday or Thursday, and the monthly futures and the other options moved to the last week of the month. 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 question to ask of a file is not what exists but what existed on the day.
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.
Test enough rules and one will pass by luck
The best of a thousand useless rules looks like a Sharpe ratio of 1.62
Read 2 more paragraphs, 375 words
The size of the luck can be put in Sharpe ratio terms. The Sharpe ratio of a rule with no skill, measured over T years, scatters around zero with a standard error of about one over the square root of T. Pick the best of N such rules and the expected best is the expected maximum of N standard normal draws, times that standard error. That maximum is 1.54 for ten rules, 2.51 for a hundred and 3.24 for a thousand. Over four years the standard error is 0.50, so the best of ten useless rules shows an annual Sharpe ratio of 0.77, the best of a hundred 1.25 and the best of a thousand 1.62. The rule chosen is the winner of the test, and the winner's number is the one printed. Bailey, Borwein, Lopez de Prado and Zhu (2014) show that high simulated performance is easy to reach after trying a small number of configurations, that the chance of overfitting rises with the number tried, and that analysts rarely report that number. Their probability of backtest overfitting (2016) measures how often the best in-sample configuration falls below the median out of sample. The deflated Sharpe ratio of Bailey and Lopez de Prado (2014) adjusts the winner's Sharpe ratio for the number of trials, the length of the record and the skew and fat tails of the returns.
Multiple testing has a statistical cure. White's Reality Check (2000) and the bootstrap of Sullivan, Timmermann and White (1999) test the best rule against the whole universe it was picked from. Harvey, Liu and Zhu (2016), looking across hundreds of published return factors, argue that a newly found factor should clear a t-ratio of 3.0, not 2.0. A t-ratio equals the annual Sharpe ratio times the square root of the years, so over four years a t-ratio of 2.0 needs an annual Sharpe of 1.0 and 3.0 needs 1.5. Harvey and Liu (2015) propose haircuts to the reported Sharpe ratio for the same reason. The guards in practice: 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.
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 (NSE/FATAX/56235), 0.10% from 1 Oct 2024 (NSE/FATAX/63809) and 0.15% from 1 Apr 2026 (NSE/FATAX/73524). 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 2 more paragraphs, 224 words
A fourth line is easy to leave out: STT on exercise. An option left to expire in the money is exercised at the settlement price, and the buyer pays STT on its intrinsic value, not on the premium. The rate was 0.125% until 31 Mar 2026 and 0.15% from 1 Apr 2026 (NSE/FATAX/73524). The 24,000 put bought at 130.25 met the 30 Mar 2026 expiry with Nifty at 22,331.40, 1,668.60 points in the money. On one lot that is Rs 1,08,459 of intrinsic value, so STT on exercise at the rate then in force was Rs 135.57, which is 16.0 times the Rs 8.47 that a sale of the same premium would have paid. A test that closes every held position at the settlement price and charges STT only on sales has dropped the larger of the two.
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. Costs were 35% of the gross losses of loss makers and 21% of the gross profits of profit makers in FY26 (Table 47 of the study), and STT's share of all transaction costs rose from 13% in FY22 to 27% in FY26.
Is the price in the file a price I could have traded?
No, for two different reasons. The first is the settlement price. A strike with few or no trades gets a settlement price that is not the price of a trade. The file for 2 Feb 2026 shows it. The 27,650 call had 0 contracts traded and open interest of 2,015 units, and settled at 12.00. The next strike up, 27,700, settled at 16.90. A call at a higher strike cannot be worth more than a call at a lower one, yet the lower strike settled below the higher. A test that fills at 12.00 trades at a price that never stood as an order.
Read 2 more paragraphs, 250 words
The second is the quote. The free files carry no bid and no ask, so a test fills at a settlement or a last traded price and pays none of the spread. Spread is a real cost. Barber, Lee, Liu and Odean (2009), who had every order on the Taiwan exchange, traced virtually all of individual investors' trading losses to aggressive orders, the ones that cross the spread. For options, Muravyev and Pearson (2020) show that the effective spread paid by traders who time their orders is less than 40% of the conventional quoted measure and that the overall average is one quarter below it, so quotes alone overstate the cost. Christoffersen, Goyenko, Jacobs and Karoui (2018) study the return premium that illiquidity commands in equity options. Between them the lesson for a test is to model the fill as a band and not a point: report the result at no spread, at a modest spread and at a wide one, and see where the edge vanishes.
Cheap options are the sharpest case, and on expiry day most options are cheap, because the price is small and the rupee spread is not. An assumed slippage of Rs 1 a unit is 0.77% of the 24,000 put's settlement price and 8.3% of the 27,650 call's. The same assumption wrecks a result on the cheap option and barely touches the dear one. Position limits, margin and the rules for the expiry session also changed on dated days, which the next section lists.
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. A test must carry the rule in force on each date.
| Date | Rule | Source |
|---|---|---|
| 1 Apr 2023 | STT on a sold option rises to 0.0625% | NSE/FATAX/56235 |
| 1 Oct 2024 | STT on a sold option 0.10%, on a sold future 0.02% | NSE/FATAX/63809 |
| 20 Nov 2024 | One weekly benchmark index per exchange. New index contract worth at least Rs 15 lakh. Extra 2% ELM on short options on their expiry day | SEBI circular of 1 Oct 2024 |
| 1 Feb 2025 | Option premium collected upfront. No calendar spread margin benefit on the expiry day | SEBI circular of 1 Oct 2024 |
| 1 Apr 2025 | Position limits also checked through the day, at least four snapshots | SEBI circular of 1 Oct 2024 |
| 26 May 2025 | Expiries of equity derivatives limited to Tuesday or Thursday | SEBI/HO/MRD/MRD-TPD-1/P/CIR/2025/76 |
| 1 Mar 2026 | NSE transaction charges revised | NSE/FA/73061 |
| 1 Apr 2026 | STT on a sold option and on exercise 0.15%, on a sold future 0.05% | NSE/FATAX/73524 |
| 3 Aug 2026 | Closing auction session starts in the cash segment, and expiry settlement follows its close | SEBI circular of 16 Jan 2026 |
| 7 Dec 2026 | Expiring index contracts stop at 3:30 pm and settle on the last thirty minute weighted average of the constituents | SEBI circular of 15 Oct 2026 |
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 2 more paragraphs, 136 words
A test that runs across the last two rows has three expiry regimes in it: the index close, then the close from the auction, then the weighted average. For expiries before 7 Dec 2026 the settlement price is the closing value of the index. After it, the settlement price depends on the last thirty minutes of trading in the constituents, so a rule that treated the closing print as the settlement needs its history read again.
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, 66 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 cost lesson is in the real cost of an F&O trade.
Second case: the same trade as a band, not a point
The put sold at 130.25 is a liquid strike, so the test's fill is close to what a trader got. Now sell one lot of the 27,650 call, which settled at 12.00 with no trade that day. The settlement price books Rs 780 of premium. If the order could fill only Rs 1 a unit lower, the premium is Rs 715, a fall of 8.3%. The band for the liquid put is a fall of 0.77% for the same Rs 1. The statutory charges barely change. The edge a test finds on the cheap strike depends almost wholly on the assumption about the fill, and that assumption is the one most often left out.

A checklist for a test
| Question | Bias it catches |
|---|---|
| Is every input lagged by one bar and time stamped? | Look ahead |
| Does the data hold the stocks, strikes and contracts of each date? | Survivorship |
| How many versions were tried, and is that count reported? | Overfitting |
| Do costs, STT on exercise and lot sizes change with the date? | Cost and regime |
| Is the fill a band, with the result shown at three spreads? | Fill |
| Does the window hold a crash and a calm stretch? | Sample |
| Was a block of data kept back and used once? | Overfitting |
What the research says
The warning is old and the statistics are settled. White (2000) and Sullivan, Timmermann and White (1999) gave tests that account for the whole search. Bailey and co-authors (2014, 2016) and Bailey and Lopez de Prado (2014) built the finance specific tools: the count of trials, the probability of overfitting and the deflated Sharpe ratio. Harvey, Liu and Zhu (2016) and Harvey and Liu (2015) put numbers on the hurdle and the haircut. On the cost side the literature is about options in particular: Muravyev and Pearson (2020) on the realised spread, Christoffersen and co-authors (2018) on illiquidity, and Bauer, Cosemans and Eichholtz (2009), whose data from a Dutch broker show that most option investors lost, with bad timing and high costs behind it. None of the papers says a backtest is useless. They say a backtest without a count of trials, dated costs and a fill band answers a question nobody asked.

Stretch: from a checklist to a procedure
The next steps are procedures, not warnings. Walk forward testing reuses the data in a way that keeps a test block unseen. Backtesting options builds the options engine with fills and costs by date, and backtest overfitting works the probability of overfitting through on a set of trials.
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, with STT on exercise, 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 requires registered investment advisers and research analysts who communicate past performance that has been verified to enrol with the Past Risk and Return Verification Agency, which began work on 4 May 2026. A backtest on a screenshot is not that.
What I'd keep from this
- 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.
- The best of many useless rules shows a Sharpe ratio above one.
- Costs, STT on exercise and rules change by date. A settlement 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