Cointegration-Based Pairs Trading with Z-Score Signals
Summary
This tutorial develops a pairs trading approach around the idea that two related assets may have a stable long-run relationship even as their prices temporarily diverge. It distinguishes cointegration from correlation, uses a cointegration test to screen candidate pairs, and turns the price ratio into a z-score signal. The example enters a long-ratio position when the ratio is low and a short-ratio position when it is high, then describes closing positions near the mean.
The document demonstrates the process with synthetic series and historical large-cap technology stock data, including a training and test split. It reports example backtest outcomes, but the shown strategy and results are illustrative rather than evidence of durable profitability. The author warns that testing many pairs creates multiple-comparison bias, market-wide effects can confound apparent relationships, financial data may have fat tails, and parameters optimized on training data can overfit. It suggests more advanced mean-reversion analysis as a possible extension.
Key ideas
- Pairs trading seeks to profit from temporary divergence between assets with a stable long-run relationship.
- Correlation alone does not establish cointegration, so candidate pairs need statistical testing.
- A rolling ratio z-score can define entry signals, with positions aimed at convergence toward the mean.
- Testing many pairs can create false discoveries through multiple comparisons.
- Training performance and optimized parameters may not carry over to unseen data.
Tags
Cited by
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.