Automated Trading and Algorithmic Strategies

Building a Robust Market-Neutral Pairs Trading Strategy: A Quantitative Analysis of NSE Large-Cap Equities

The discipline of statistical arbitrage has long served as a cornerstone for institutional trading desks, relying on the mathematical principle that temporary price divergences between two historically correlated assets will eventually revert to their mean. Shant Tandon, a quantitative finance analyst with a background in financial markets and consulting, has unveiled a comprehensive backtesting study that applies these principles to the National Stock Exchange (NSE) of India. By analyzing 25 large-cap stocks across diverse sectors—including Banking, IT, Pharma, Cement, and Auto—Tandon’s research provides a rigorous, academically sound framework for executing market-neutral strategies while addressing the persistent risks of look-ahead bias and false statistical discovery.

The study, which covers a ten-year window from January 1, 2015, to June 30, 2025, serves as a prototype for modern algorithmic trading. In an environment often cluttered with "black box" strategies, Tandon’s approach emphasizes transparency and technical defensibility. The core methodology employs a rolling walk-forward train-test split, ensuring that the model is continuously calibrated against evolving market regimes rather than relying on static historical parameters that rarely hold up in real-world conditions.

The Methodology of Cointegration and Statistical Robustness

At the heart of the project lies the selection of trading pairs through rigorous cointegration testing. Pairs trading thrives on the assumption that while individual stock prices may wander, the linear combination of two related assets remains stationary—meaning the "spread" between them tends to return to a long-term average.

Tandon utilized Ordinary Least Squares (OLS) to estimate the hedge ratio (beta) for potential pairs. To validate these pairs, the study employed the Augmented Dickey-Fuller (ADF) test, specifically the ADF(0) variant, to calculate MacKinnon p-values. Crucially, the project accounted for the "multiple testing problem," a common pitfall where testing numerous asset combinations increases the likelihood of finding "statistically significant" correlations that are merely the result of random noise. By applying the Benjamini-Hochberg False Discovery Rate (FDR) at a 5% threshold, Tandon ensured that only the most statistically robust pairs were selected for the portfolio.

The filtering process resulted in three primary pairs: HDFCBANK.NS vs. KOTAKBANK.NS, HEROMOTOCO.NS vs. ULTRACEMCO.NS, and HCLTECH.NS vs. ICICIBANK.NS. These pairs, spanning diverse industries, represent the bedrock of the strategy’s neutral positioning.

Cointegrated Pairs Trading Strategy in Indian Equity Market (2015–2025) | EPAT Project

Chronology and Operational Implementation

The strategy’s implementation follows a disciplined chronological workflow. The training phase utilizes a 252-trading-day window, followed by a 21-day out-of-sample testing step. This walk-forward approach is essential for preventing look-ahead bias, a common error where future price information inadvertently influences past trading decisions. By shifting rolling variables such as mean and standard deviation by one day, the strategy simulates a genuine "live" trading environment.

The execution logic is triggered by the z-score of the spread. When the z-score exceeds a threshold of 1.5, the strategy enters a position, betting on the spread to contract toward zero. A total of 271 trades were executed over the backtest period, with a capital allocation of ₹5,00,000 per active pair. The model explicitly accounts for transaction costs—factoring in 5 basis points per leg per side—which provides a more realistic assessment of net profitability than many theoretical models that ignore market friction.

Performance Metrics and Analytical Findings

The results of the decade-long backtest highlight both the potential and the inherent challenges of statistical arbitrage in the Indian equity market. The portfolio achieved a win ratio of 63.47%, demonstrating the strategy’s effectiveness in identifying mean-reverting behavior. Total profit and loss (PnL) reached ₹1,65,544.97, representing an 11.04% return on the initial capital base.

However, the performance data also reveals significant volatility. While the strategy maintained a positive expectancy, the annualized return stood at a modest 0.30% against an annualized volatility of 13.34%. The Sharpe ratio of 0.089 indicates that, in its current form, the strategy requires further optimization to better balance risk against reward. The maximum drawdown of -34.31% serves as a critical observation, highlighting that even market-neutral strategies can experience significant capital erosion during prolonged periods of market regime shifts or idiosyncratic volatility in specific sectors.

Implications and Future Refinements

The findings suggest that while the mathematical foundation of the strategy is sound, the real-world application requires more dynamic risk management. Experts in the field note that the current drawdown profile is a common hurdle for mean-reversion strategies, which often struggle during "trending" markets where divergences widen indefinitely rather than reverting to the mean.

To address these limitations, Tandon’s research outlines a clear path for future development. One of the most significant proposed improvements is the transition from a static ADF(0) test to an information-criterion-based lag selector, such as the Akaike Information Criterion (AIC) or Bayesian Information Criterion (BIC). This would likely improve the quality of the cointegration signals, reducing the risk of entering trades on pairs that are not truly cointegrated.

Cointegrated Pairs Trading Strategy in Indian Equity Market (2015–2025) | EPAT Project

Furthermore, the study highlights the need for dynamic position sizing. Moving away from a fixed allocation toward inverse-volatility or Kelly-criterion-based weighting could protect the portfolio from high-volatility events. The integration of stop-loss rules—a missing component in this baseline model—is identified as a priority for capping downside risk. By introducing an automatic exit mechanism when a z-score breaches a threshold of ±3.0 or when unrealized losses hit a predetermined percentage, the strategy could significantly improve its risk-adjusted returns.

The Broader Landscape of Algorithmic Trading in India

The project by Shant Tandon serves as a valuable case study for the growing community of quantitative traders in India. As the NSE continues to evolve, the demand for transparent, data-driven trading strategies has grown. The use of Python, as demonstrated in the project’s technical implementation, has become the industry standard for backtesting and signal generation.

The broader implications of this study are twofold. First, it underscores the difficulty of achieving high Sharpe ratios in statistical arbitrage without incorporating adaptive, regime-aware models. Second, it highlights the importance of rigorous "out-of-sample" testing. By adhering to a strict walk-forward methodology, the research avoids the trap of curve-fitting—where a model is optimized to fit past data so perfectly that it fails to predict future movements.

For institutional and retail traders alike, the transition from this academic prototype to a live, production-ready system requires a focus on market microstructure. Factors such as liquidity, slippage, and the impact of corporate actions must be integrated into the algorithm. Additionally, addressing survivorship bias—by using point-in-time constituent lists rather than a fixed set of companies that happened to survive until 2025—will be essential for those seeking to implement this strategy in a real-world brokerage environment.

In conclusion, Tandon’s work provides a disciplined, step-by-step framework for building a statistical arbitrage strategy. While the performance metrics indicate that there is significant room for optimization, the project successfully establishes the necessary infrastructure for reliable quantitative research. For those entering the field of algorithmic trading, the study serves as a practical roadmap: focus on robust statistical testing, respect the impact of transaction costs, and prioritize the implementation of stop-loss mechanisms to safeguard capital against the unpredictable nature of the equity markets. As the industry moves toward more sophisticated machine learning and artificial intelligence applications, the fundamental principles of cointegration and mean reversion—as presented here—remain the essential building blocks of successful quantitative finance.

Related Articles

Back to top button