Why Backtesting Matters
Backtesting is like testing a car before buying it. You run your trading strategy on historical data to see how it would have performed. A good backtest gives you confidence to trade with real money. A bad backtest can lead to devastating losses.
Mistake 1: Overfitting
Overfitting is when your strategy performs great on historical data but fails in live trading. This happens when you optimize parameters too much for past data. If your strategy has 20 parameters and 100 trades, you are probably overfitting.
Solution: Use out-of-sample testing. Split your data into training (70%) and testing (30%). Only optimize on training data.
Mistake 2: Look-Ahead Bias
This happens when your strategy uses information that would not have been available at the time of trading. For example, using today's closing price to make a trading decision at market open.
Solution: Use only past data for decisions. Shift all indicators by at least 1 day.
Mistake 3: Survivorship Bias
Using only current stocks ignores delisted companies. If you backtest on Nifty 50 stocks today, you miss companies that went bankrupt. This makes your backtest look better than reality.
Solution: Use point-in-time data that includes delisted stocks.
Mistake 4: Ignoring Transaction Costs
Brokerage, STT, stamp duty, and slippage eat into profits. A strategy that makes 1% per trade but pays 0.5% in costs is barely profitable.
Solution: Include realistic transaction costs in your backtest.
Mistake 5: Not Accounting for Slippage
Slippage is the difference between expected price and actual execution price. In illiquid stocks or during volatility, slippage can be significant.
Solution: Add 0.1-0.3% slippage per trade to your backtest.
Mistake 6: Data Snooping
Testing multiple strategies on the same data increases the chance of finding a profitable one by pure luck. If you test 100 strategies, 5 will look profitable even with random data.
Solution: Use Bonferroni correction or hold out a final test set.
Mistake 7: Not Testing Across Market Regimes
A strategy that works in bull markets may fail in bear markets. Test your strategy across different market conditions.
Solution: Backtest across 2018 (bull), 2020 (crash), 2021 (recovery), 2022 (bear).
SEBI Disclaimer
This article is for educational purposes only. Algorithmic trading involves substantial risk of loss.
Turn the Checklist Into a Gate
The seven mistake categories form a launch checklist; a strategy that fails any gate goes back, not forward. The gate order matters:
- Survivorship: did the universe include delisted and bankrupt names, or only today's survivors? A gap here inflates everything else.
- Overfitting: would the same hyperparameters survive a fresh regime split, or were they tuned on the winning slice?
- Look-ahead: is any feature unknowable at decision time? Re-compute features from a cutoff, not a full frame.
- Costs: STT, brokerage, slippage and funding applied per trade at realistic fills, not at the touch.
- Data snooping: are you testing 200 strategies and reporting the best one as if it were the only one? Multiply every p-value by the number of trials.
- Regime coverage: does the window include a crash, a recovery and a sideways year?
- Account reality: are positions sized like the account will, with correlated exposure and capital-weighted returns?
Monte Carlo Overlay: The Strategy as a Distribution
Backtests produce one equity path; a Monte Carlo overlay produces a family of them:
- Resample the trade list with replacement to build 1,000 alternative orders of the same trades and inspect the drawdown distribution.
- Read the 10th-percentile drawdown, not just the median; a strategy whose worst decile sits beyond your capital tolerance is a strategy you cannot survive to enjoy.
- Vary slippage, not just trade order, by resampling fill offsets from your own historical spread data.
Modelling NSE Lot-Size Costs Precisely
Indian F&O costs hide in the lot-size granularity:
- STT applies on sell (futures) and option premiums; transaction charges, exchange fees, GST, stamp duty and SEBI fees stack per lot, not per rupee.
- A backtester that models flat "brokerage" but skips transaction charges underprices every month; the gap compounds with frequency.
- Round-trip friction on a 1-lot Nifty spread routinely lands near ₹150-300; a strategy earning 0.5% a month gross must clear that every single rotation.
Gapped-Data Tests: The Silent Survivor Kiss
Most backtests silently drop the days the market gapped apart, and those are precisely the days edge decides:
- Fill every gap as a realised event: a gap through your stop is a fill at the gap's far price, never a skipped day.
- Test the strategy on "expiry + holiday" resampling too: Indian calendars (holidays, weekly expiries) shift gap patterns that naive 5-day calendars erase.
- Where a gap breached the stop, charge the gap slippage explicitly; pretending it did not happen flatters the curve and falsifies every conclusion.
The Equity-Curve Review That Catches the Lies
Run the final honesty ritual: plot the cumulative equity, the underwater curve, and the month-by-month return band side by side.
- A curve whose returns are one fat month atop a flat plateau is a lottery with a promotion rate, not a signal.
- A 24-month underwater streak bigger than any single strategy you have traded live is the same warning in a different language.
- Compare the backtest's worst drawdown to your live paper-trading worst drawdown; if the gap exceeds the cost model, the cost model is still wrong.
The 7 mistakes are not a lecture list; they are a pre-approval gate. A strategy that passes survivorship honestly, overfitting discipline, gapped-data fills and lot-scale costs has earned its right to paper trading; the strategy that fails one gate has earned the right to be simplified, not funded.