Skip to content

What Is Backtesting? A Beginner's Guide for Indian Traders

Backtesting shows how a trading strategy would have performed on past data. Learn how it works, what the results mean and what a backtest cannot tell you.

What Is Backtesting? A Beginner's Guide for Indian Traders - Cirrus blog thumbnail
On this page
  1. What backtesting means
  2. How a backtest works, step by step
  3. What a backtest tells you
  4. A simple example (illustrative numbers)
  5. Testing pitfalls that make a backtest look better than it is
  6. Backtesting in India: STT, F&O and SEBI's algo rules
  7. What a backtest cannot tell you
  8. Backtesting on Cirrus
  9. Frequently Asked Questions
  10. 1. What is backtesting in simple words?
  11. 2. Is a backtest accurate?
  12. 3. How much historical data do I need for a backtest?
  13. 4. What is the difference between backtesting and paper trading?
  14. 5. Can a good backtest guarantee profit?
  15. 6. Do I need to code to backtest a strategy?
  16. At a Glance

Before you put a single rupee behind a trading idea, you can ask a simple question: what would have happened if I had followed these exact rules over the last few years? Answering that question is what backtesting is all about. It will not predict the future, but it can save you from trading an idea that never worked in the first place. If you are new to automation, our guide to what algo trading is is a good place to start.

What backtesting means

Backtesting means applying a strategy's rules to historical price data to see how it would have performed. You take clear rules for entry, exit and position size, run them over past candles as if you were trading in real time, and record every trade the rules would have taken.

The key word is rules. A backtest only works when the strategy is written down precisely enough that a computer could follow it without guessing. If you are still at the idea stage, read how to turn a trading idea into a rule-based strategy first.

How a backtest works, step by step

  1. Write the rules. Define when to enter, when to exit, how much to buy and the most you are willing to lose on a trade.
  2. Choose the data. Pick the instrument, the candle size and the period. A longer period that includes calm, volatile and falling markets is more informative than one good year.
  3. Replay the past. The software moves through the data one candle at a time and applies your rules, placing simulated trades.
  4. Record every trade. Each simulated trade has an entry, an exit and a result.
  5. Read the results. Summary numbers turn the list of trades into something you can judge.

What a backtest tells you

Most backtests report a handful of standard measures:

  • Net return: the profit or loss after the whole run, ideally after costs.
  • Win rate: winning trades divided by total trades, shown as a percentage.
  • Maximum drawdown: the largest fall from a peak to a later low before a new peak.
  • Profit factor: gross profit divided by gross loss. Above 1 means winners outweighed losers in that sample.

No single number is enough. A high win rate can still lose money if the losses are larger than the wins, and a big return is hard to live with if the drawdown along the way is more than you can stomach.

A simple example (illustrative numbers)

Here is a made-up example to show how the numbers fit together. Say a strategy took 40 trades over a test period. Of these, 22 were winners and 18 were losers. The average winner made ₹1,200 and the average loser lost ₹900.

  • Win rate: 22 ÷ 40 = 55%
  • Gross profit: 22 × ₹1,200 = ₹26,400
  • Gross loss: 18 × ₹900 = ₹16,200
  • Gross P&L (before costs): ₹26,400 − ₹16,200 = ₹10,200
  • Profit factor before costs: ₹26,400 ÷ ₹16,200 = about 1.63

Now add costs. If brokerage, taxes and slippage together cost about ₹143 per trade, as in our worked example in Why Most Trading Ideas Die After Costs, that is 40 × ₹143 = ₹5,720. Net P&L after costs is ₹10,200 − ₹5,720 = ₹4,480. To see the effect on profit factor, take the cost off every trade: each winner now earns ₹1,200 − ₹143 = ₹1,057, and each loser costs ₹900 + ₹143 = ₹1,043. Gross profit becomes 22 × ₹1,057 = ₹23,254, gross loss becomes 18 × ₹1,043 = ₹18,774, and the profit factor falls from about 1.63 to about 1.24 (₹23,254 ÷ ₹18,774). Same strategy, very different story. These numbers are invented for illustration and are not results from any real strategy.

Testing pitfalls that make a backtest look better than it is

A flattering backtest is often the result of a flaw in the test, not a strong strategy. Four are worth knowing from the start:

  • Overfitting: tuning the rules so closely to past data that they capture random noise. The more settings you adjust until the curve looks good, the more likely the result will not repeat.
  • Look-ahead bias: using information that was not available at the moment of the trade, such as acting on a candle's closing price before the candle has closed.
  • Survivorship bias: testing only on stocks that exist today, which leaves out companies that were delisted or fell out of an index and makes the past look kinder than it was.
  • No out-of-sample test: building and judging the rules on the same data. Keep a later stretch of data aside, test on it once, and treat a big drop in results as a warning.

Backtesting in India: STT, F&O and SEBI's algo rules

Indian markets add a few details that a generic backtest can miss.

Securities Transaction Tax (STT). STT is charged on the sell side of futures and options trades and is often the largest statutory cost for an active F&O strategy. From 1 April 2026, following the Finance Act 2026, it is 0.15% of the option premium on option sales and 0.05% of the traded value on futures sales, according to an NSE circular dated 31 March 2026. Rates change, so a backtest should apply the rate that was in force on each date.

F&O basics. A futures contract is an agreement to buy or sell at a set price on a set expiry date. An option gives the buyer the right, but not the obligation, to do so. Both trade in lots whose size is set by the exchange and revised from time to time, and both need margin. A test that ignores lot size, expiry dates or margin will overstate what an account could actually have done.

SEBI's algo-trading rules. SEBI's circular of 4 February 2025 on safer participation of retail investors in algorithmic trading set up a framework that, according to NSE, came into effect on 1 April 2026. Under it, strategies are run on the broker's servers and orders originate from the broker's systems. A client who hosts their own algo needs a static IP for it. Check your broker's current requirements before taking any automated strategy live.

What a backtest cannot tell you

A backtest cannot guarantee future results. Markets change, and a rule set that worked in one period can fail in another. Backtests are also only as honest as their assumptions. If they ignore charges, assume perfect fills or use data with gaps, the results look better than reality. We cover the data side in Why Trading Algorithms Need Clean Historical Data.

That is why a backtest is a first filter, not a green light. After it, the sensible next step is to watch the strategy run on paper with live prices, and only then use real money in small size.

Backtesting on Cirrus

On Cirrus, a backtest runs through the same engine that runs live strategies. You can test over up to about 3 years of 1-minute history, depending on your plan, and you can include Indian charges and a slippage setting. After the run you can read every simulated trade, which makes odd results easy to spot. When you are ready, the same strategy can run on paper accounts with live prices.

Want to see how your own idea holds up? Try backtesting on Cirrus.

Frequently Asked Questions

1. What is backtesting in simple words?

Backtesting means checking how a trading strategy would have performed on past market data. You write clear rules for entering and exiting trades, run them over historical prices, and see the trades they would have produced. The result shows measures such as net return, win rate, maximum drawdown and profit factor. It is like a practice exam taken with last year's questions. It tells you whether the idea had any merit before you risk money, but it cannot promise the same outcome in the future, because markets keep changing and costs matter.

2. Is a backtest accurate?

A backtest is only as accurate as its data and assumptions. If it uses clean, complete price data, counts brokerage, taxes and slippage, and applies your rules exactly as written, it gives a useful picture of how the idea behaved in the past. If it ignores costs, assumes every order fills at the ideal price, or tunes the rules too closely to history, it will flatter the strategy. Treat the result as a rough guide, then confirm it with paper trading before using real money. Always check how the test handled charges and fills before trusting any number.

3. How much historical data do I need for a backtest?

There is no single right amount, but the period should include different market conditions such as rising, falling and sideways phases. A test on one calm year can look excellent and still fail in a volatile one. You also need enough trades for the numbers to mean something, because a handful of lucky trades proves very little. Many traders prefer several years of clean data and a few hundred trades, and they keep a portion aside that they did not use while building the rules. Quality matters as much as length, so check for gaps and wrong prices first.

4. What is the difference between backtesting and paper trading?

Backtesting replays past data to see how a strategy would have done. Paper trading runs the strategy forward in real time, using virtual money and live prices, so nothing is replayed. Backtesting is fast, because years of history can be tested in minutes. Paper trading is slower but shows how the strategy behaves in current conditions, including real delays and price movement. Most careful traders use both: a backtest first to filter weak ideas, then paper trading to confirm the survivors before going live. Together they give a fuller picture than either one alone.

5. Can a good backtest guarantee profit?

No. A backtest only shows how the rules would have performed in the past, and past performance may or may not be sustained in future. Markets change, costs add up, and real fills differ from simulated ones. A strong backtest is a good sign that an idea deserves more testing, not proof that it will make money. That is why risk limits, small starting size and paper trading matter. Treat every backtest result as a hypothesis to be checked, never as a promise. Use it to decide what deserves more testing, and always keep risk limits in place.

6. Do I need to code to backtest a strategy?

Not necessarily. Many platforms let you describe a strategy through settings or a template without writing code. On Cirrus, a strategy is a saved document, and you can start from a template and then change the rules to suit your idea. What matters most is not coding but clarity: your entry, exit, position size and maximum loss must be defined precisely enough for a machine to follow. If you cannot explain the rules in plain words, the backtest will not be meaningful either. Start simple, test it, and improve one rule at a time.

At a Glance

TopicKey point
What it isRunning a strategy's rules over past data to see how it would have performed
Key outputsNet return, win rate, maximum drawdown and profit factor
Before you startWrite precise entry, exit, position size and maximum loss rules
DataSeveral years of clean data covering rising, falling and sideways markets
CostsInclude brokerage, taxes and slippage, or results look better than reality
PitfallsOverfitting, look-ahead bias, survivorship bias and no out-of-sample test
India specificsSTT rates by date, F&O lot size and expiry, and SEBI's algo-trading framework
LimitsA backtest cannot guarantee future results
Next stepPaper trade with live prices, then go live small
On CirrusUp to about 3 years of 1-minute history, depending on your plan, with charges, slippage settings and a trade-by-trade view

Disclaimer: This blog is for education only and is not investment advice. Backtest results do not guarantee future returns. Cirrus is a technology platform and does not give investment advice.

All guides