← Algo & Backtesting

Running an options backtest: every setting, and what it changes

Most backtests that look too good were set up to look good: no costs, no slippage, and stops that only check the closing price. The Backtest page in Algo puts each of those choices in front of you as a setting, with defaults that lean towards realistic.

What a backtest run is, and what it is not

A backtest replays a strategy you have already built against minute-by-minute history and reports what it would have done, day by day.

In Algo the strategy is built once in the Strategy Builder — legs, strikes, entry and exit rules, stops. The Backtest page does not change any of that. It decides only how the replay is run: which dates, what friction to charge, what capital to measure returns against, and how strictly stops are tested inside each bar.

Those few choices move results more than most strategy tweaks do, which is why each one gets its own section below. The general case for why a backtest needs them is in options backtesting in India; this post is about the settings themselves.

What you can backtest, and over what dates

The replay runs on 1-minute bars: option open, high, low, close, open interest and IV for the chain around the money, plus spot bars. Index history starts on different dates because the contracts listed on different dates:

UnderlyingHistory from
NIFTYJanuary 2019
BANKNIFTYJanuary 2019
FINNIFTYJanuary 2021
MIDCPNIFTYJanuary 2022
SENSEXMay 2023
NIFTYNXT50April 2024

Single-stock options are also covered, with monthly expiries only and a start date that varies by stock. MCX commodities have no backtest archive — use a forward test for those. One run can span up to about five years; how far back you can go also depends on your plan (see /pricing).

The Underlying box on the Backtest page is filled in from the strategy and cannot be edited. That is deliberate: a SENSEX strategy can never be replayed on NIFTY bars by mistake.

The settings, one by one

SettingWhat it changes
Range presets 1M, 6M, 1Y–5YSet From and To in one click. The end date is set about a week back, because the most recent days are still being added to the archive. You can type any dates instead.
Cost ₹/order (default 20)A flat charge for brokerage, STT, GST, exchange and stamp duty on each order. Every buy and every sell is one order.
Slippage % (default 0.5)An adverse fill on every leg's entry and exit, as a percentage of the option price. A sell fills that much lower, a buy that much higher.
Capital ₹ (default ₹10 lakh)The base for Return % and CAGR. When the report knows the real margin the strategy blocks, returns are measured on that margin instead.
Intrabar SL/TGT (on by default)On: price-level stops and targets are tested against each bar's high and low and fill at the trigger level. Off: they are tested on the bar close and fill at the next bar's open.
ModeSingle strategy, or a whole portfolio replayed over the same dates and combined into one equity curve, each strategy on its own underlying.

Leave intrabar on. With it off, a spike that hits your stop and retraces before the minute closes is simply missed, and the result is flattered by stops that would have fired in real trading.

The Backtest form with a saved NIFTY straddle picked: range presets, cost per order, slippage, capital and the Intrabar SL tick box.
The Backtest form with a saved NIFTY straddle picked: range presets, cost per order, slippage, capital and the Intrabar SL tick box.

A worked example: what friction costs a straddle

Take a hypothetical short straddle — sell one call and one put — that enters and exits once a day, with a 75-unit position per leg.

So a strategy that shows ₹300 a day before friction keeps roughly ₹100 after it. That is the whole reason the report shows Plain, With Costs and With Slippage side by side — see reading the backtest report.

A saved backtest report for a NIFTY strangle: rules summary at the top, then return, cost drag, drawdown and ratio tiles.
A saved backtest report for a NIFTY strangle: rules summary at the top, then return, cost drag, drawdown and ratio tiles.

Common mistakes

Where to find it

  1. Open Algo and build and save the strategy in the Strategy Builder.
  2. Go to Backtest. Choose Single strategy or Portfolio, then pick it.
  3. Click a range preset or type From and To.
  4. Set Cost ₹/order, Slippage % and Capital ₹, and leave Intrabar SL/TGT ticked.
  5. Optionally add an entry signal file or chart script, or switch on a parameter sweep.
  6. Click Run Backtest. The report opens on its own page when the run finishes.

Common questions

What cost per order should I use for an options backtest in India?

Use your own all-in charge per executed order: brokerage plus STT, GST, exchange fees and stamp duty. ₹20 is the default and a typical flat-brokerage figure. Every buy and every sell counts as one order.

Does the backtest fill stops at the bar's close?

Not by default. With Intrabar SL/TGT on, price-level stops and targets are checked against each 1-minute bar's high and low and fill at the trigger price, the way a live stop order would. Turning it off tests on the close and fills at the next bar's open.

Which underlyings can I backtest in Algo?

NIFTY and BANKNIFTY from January 2019, FINNIFTY from 2021, MIDCPNIFTY from 2022, SENSEX from May 2023, NIFTYNXT50 from 2024, and single-stock options with monthly expiries. MCX has no backtest history; forward test it instead.

Why can't I change the underlying on the Backtest page?

It is taken from the strategy's own legs so that a strategy can never be replayed on the wrong index's bars. To test another underlying, change it in the Strategy Builder.

Can I backtest several strategies together?

Yes. Choose Portfolio mode and every strategy in the portfolio is replayed over the same dates, each on its own underlying, and combined into one equity curve and drawdown.

More on Algo & Backtesting

More in Algo & Backtesting · App: Algo & Backtest · Definitions: glossary · All: every article