A backtest is only honest when the rule is fixed before the data is opened
A backtest replays a rule over past data and counts what it would have done. NSE publishes end of day files that give each contract's settle price, open interest and volume, with the lot size and expiry day for each date. They hold no intraday fills, bid and ask, or order queue. NSE's terms of use limit how its data may be used and shared, so read them first.
The steps come in a fixed order. Write the rule first: the entry, the strike rule, the exit and the size. Fix the data period and hold part of it back. Charge every cost on each leg: brokerage, exchange charges, GST, stamp duty and STT, which on options falls on the premium sold and on exercise.
Count trades, not the curve. Report the number of trades and expiries, the win rate, the average win and loss, expectancy, the worst run and the drawdown. Ten trades can look like a result and still be noise. A rule changed after the test is a new rule and needs a new test.
Python is a tool, not a method. The same code will repeat any mistake in the rule, such as using a settle price that was not known at the entry, or choosing a strike after the close. Module I34 covers five biases that make a backtest look better than it is, and A28 covers options data steps. If a rule later runs live through a broker's API, the retail algo rules apply: see the question on algo legality.
The school publishes no backtest of a named strategy as a result. A rule tested on a dated chain illustrates method, not performance.
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