What Is Backtesting in Trading?
Backtesting is the process of applying a trading strategy to historical price data to see how it would have performed in the past. The goal is to estimate the strategy's profitability, risk, and reliability before committing real capital. A well-backtested strategy gives traders confidence that their rules have an edge, while revealing weaknesses that need to be fixed before going live in Indian markets.
Why Backtesting Is Essential
Live trading with untested rules is equivalent to gambling. Backtesting provides a statistical foundation: win rate, average profit per trade, average loss per trade, maximum drawdown, and risk-reward ratio. If a strategy does not show positive expectancy on historical data, it is unlikely to work in real time.
Key Metrics from a Backtest
- Win rate: Percentage of trades that were profitable. A 50% win rate with 1:2 risk-reward is still highly profitable.
- Profit factor: Total gross profit divided by total gross loss. A profit factor above 1.5 is considered good.
- Maximum drawdown: The largest peak-to-trough decline in portfolio value during the test period.
- Expectancy: Average profit per trade. A positive expectancy means the strategy makes money over many trades.
- Number of trades: A backtest on 20 trades is statistically unreliable; ideally test on 200 or more trades.
Steps to Backtest a Strategy
- Define the strategy rules clearly: entry signal, stop-loss level, target, position size.
- Gather historical OHLCV (Open, High, Low, Close, Volume) data for NSE or BSE stocks.
- Apply the rules manually on charts or use software to scan each bar of historical data.
- Record every trade: entry price, exit price, profit or loss.
- Calculate total return, win rate, profit factor, and maximum drawdown.
- If results look good, perform forward testing (paper trading) for four to eight weeks before going live.
Common Backtesting Mistakes
| Mistake | Why It's a Problem |
|---|---|
| Curve fitting | Over-optimising parameters to past data; the strategy fails on new data |
| Ignoring slippage and brokerage | Real trades have execution costs that eat into profits |
| Testing on too short a period | May miss bear markets, sideways periods, or black swan events |
| Survivorship bias | Testing only on stocks that still exist today; stocks that were delisted are excluded |
Manual vs. Software Backtesting
Manual backtesting involves going through charts bar by bar and recording trades. It is time-consuming but builds intuition. Software tools and platforms that integrate with NSE/BSE data allow automated backtesting across hundreds of stocks simultaneously, which is more practical for systematic traders.
Key Takeaway
Backtesting is the only way to know whether a trading strategy has a real edge before risking real money. Always test on at least 12 to 24 months of data covering different market conditions. Use the Lemonn app to analyse historical price data, study chart patterns, and validate your trading ideas before deploying them in live Indian markets.