Backtesting
Every algorithmic trading strategy should be backtested before live deployment. Backtesting applies the strategy's rules to historical OHLCV (open, high, low, close, volume) data — and optionally tick-level data for more precise simulations — to generate a track record of hypothetical trades and performance metrics.
Key Backtesting Metrics for Indian Strategies
- CAGR (Compound Annual Growth Rate): The annualized return of the strategy over the backtest period
- Sharpe Ratio: Risk-adjusted return (return minus risk-free rate, divided by volatility). India risk-free rate ≈ 7% (RBI repo rate / G-Sec yield). A Sharpe >1.5 is the minimum bar for most institutional strategies.
- Maximum Drawdown (MDD): The largest peak-to-trough decline. Institutional strategies typically target MDD < 15-20%.
- Win Rate: Percentage of trades that were profitable. Counterintuitively, strategies with win rates of 40-50% can still be highly profitable if winners are significantly larger than losers.
- Profit Factor: Gross profit divided by gross loss. A profit factor >1.5 is generally considered acceptable.
- Sortino Ratio: Like Sharpe, but only penalizes downside volatility — more relevant for trend-following strategies.
Common Backtesting Pitfalls
Look-Ahead Bias
Look-ahead bias occurs when the strategy uses information that was not available at the time the trade would have been executed. For example, using the closing price to generate a signal that was executed at that same closing price. This is the most common and most damaging backtesting error — it produces inflated results that will never be replicated in live trading.
Survivorship Bias
When backtesting on a current stock universe, the historical data naturally excludes companies that went bankrupt, were delisted, or merged. This biases the backtest results upward because the strategy would have avoided companies that subsequently failed. On NSE, this is particularly relevant for mid and small cap strategies.
Overfitting
Overfitting occurs when a strategy is excessively tuned to historical data — its parameters are optimized to perform well on past data but have no predictive validity for future markets. The result is a strategy that looks exceptional in backtesting but fails immediately in live trading. Out-of-sample testing (walk-forward analysis) is the primary defense against overfitting.
Backtesting in Indian Capital Markets
NSE provides end-of-day OHLCV data going back to 1994 and tick-level data from approximately 2014. BSE similarly offers historical data for its listed securities. MCX (Multi Commodity Exchange) data is available for commodities including gold, silver, and crude oil.
For options strategies — particularly Nifty and BankNifty weekly options — accurate backtesting requires options chain data with Greeks (delta, gamma, theta, vega) across strikes and expiries. This data is expensive and harder to obtain, which is why institutional-quality backtests for F&O strategies require specialized data infrastructure.
EquiDrift61's strategy library includes strategies with verified backtest results, with metrics including Sharpe ratio, Sortino ratio, maximum drawdown, and monthly returns heatmaps. All strategies must exceed a Sharpe ratio of 3 in backtesting before inclusion.
Frequently Asked Questions
Backtesting simulates a strategy against historical data — it happens offline and instantly. Paper trading (also called forward testing or demo trading) runs the strategy in real-time against live market data without real capital at risk. Backtesting covers years of data quickly; paper trading confirms real-time execution quality but takes time to accumulate meaningful statistical samples.
NSE provides historical OHLCV data via its website and through data vendors like Refinitiv, Bloomberg, and Indian services such as Truedata, Global Data Feed, and others. For options backtesting, vendors like Opstra, NSE's own historical options data, and specialized quant data providers offer strike-level chain data. Tick-level data is available from 2014 via institutional data providers.
A statistically meaningful backtest should include at least 2-3 full market cycles (roughly 7-10 years for Indian markets), covering a bull market, bear market, and sideways period. Strategies that are only tested on recent bull markets (2020-2024) have insufficient out-of-sample validation. The 2008 financial crisis and 2020 COVID crash are critical stress periods to include.
The primary reasons are: (1) overfitting to historical data, (2) look-ahead bias that inflated backtest results, (3) transaction costs (slippage, brokerage, STT) not being accurately modeled, (4) market regime changes — a strategy optimized for a low-volatility regime may fail when volatility spikes, and (5) market impact — a large position that had no price impact in backtesting may move prices when executed live.
Related Terms
Put this knowledge to work.
EquiDrift61 applies backtesting concepts across its institutional risk dashboard, AI agents, and curated strategy library for NSE, BSE, and MCX markets.
Back to Glossary