Backtesting a trading strategy without fooling yourself
By the TradeLite team · 29 October 2026 · All guides
Backtesting means applying a set of trading rules to past market data to see how they would have performed. It is a powerful way to reject bad ideas cheaply, but it is also easy to produce results that look excellent on paper and fail in live markets.
What backtesting is
A backtest takes clearly defined rules for entry, exit, stop-loss and position size, runs them over historical prices, and records every resulting trade. The output is a set of statistics such as number of trades, win rate, average win and loss, expectancy, profit factor and maximum drawdown.
Backtests can be done by hand, by stepping through charts with replay, or automatically with a strategy tester. Either way, the rules must be precise enough that there is no judgement involved in applying them.
A simple process
- Write the rules first, before looking at results: market, timeframe, entry trigger, stop-loss, exit and position size.
- Choose the data. Use a long enough period to include different market conditions: trends, ranges, quiet and volatile phases.
- Include costs. Add brokerage, taxes, spread and slippage. Our guide to trading costs in India lists the components.
- Record every trade, not just the interesting ones.
- Review the statistics, especially expectancy after costs and the worst drawdown.
Biases that mislead
- Look-ahead bias: using information that was not available at the time of the trade, such as a day's closing price to make a decision during that day.
- Survivorship bias: testing only on stocks that exist today, ignoring those that were delisted or fell out of an index, which usually makes results look better.
- Unrealistic fills: assuming you always get your exact price, even in fast markets or illiquid instruments.
- Ignoring gaps: assuming stops always fill at the stop price, when overnight gaps can jump past them.
- Selective memory: in manual backtests, unconsciously skipping trades that "obviously" would not have been taken.
The overfitting trap
Overfitting, or curve fitting, happens when you adjust parameters until the backtest looks great on one set of data. With enough tweaking, almost any rule can be made to look profitable in the past, because it has been shaped around random noise rather than a real pattern.
- Prefer simple rules with few parameters.
- Be suspicious of results that depend on a very precise setting, such as a 17-period average working but 15 and 20 failing.
- Split your data: develop rules on one period, then test them unchanged on a separate period you have not looked at. This out-of-sample test is far more informative.
Forward testing
After a backtest, the next step is forward testing: trading the rules in real time without real money, through paper trading, for a meaningful number of trades. Forward testing shows whether you can actually follow the rules in real time and whether results hold in current conditions. Only then consider small live positions.
A backtest checklist
- Rules written before testing, with no discretion.
- At least 100 trades where possible, across different market conditions.
- Realistic costs and slippage included.
- No look-ahead or survivorship bias.
- Out-of-sample period tested with unchanged rules.
- Maximum drawdown you could genuinely live through.
- Forward-tested before live trading.
Remember that past performance does not guarantee future results. A good backtest is evidence worth considering, not a promise.
Further reading
- SEBI research reports: including the studies on individual traders in equity F&O.
- SEBI investor education website: official guides for investors and traders from the market regulator.
- National Institute of Securities Markets (NISM): courses and certifications on securities markets and derivatives.
More guides
- Overtrading: why it happens and how to stop it
- How to set a daily loss limit you will actually keep
- Revenge trading: recognising it and breaking the cycle
This guide is for education only. It is not investment advice or a recommendation to buy or sell any security. Trading in securities and derivatives involves risk of loss. Read our Risk Disclosure.