Pairs Trading Cointegration Tester
Test whether two stocks truly move together long-term — hedge ratio, spread z-score, half-life and a stationarity check for mean-reversion pairs trading.
Price Series Input
Comma or line separated, oldest first
Same length as Stock A
Cointegration Results
Hedge Ratio (β)
–
Half-Life (bars)
–
Current Z-Score
–
Correlation
–
Signal
–
Spread Mean
–
Spread StdDev
–
Stationarity
–
Frequently Asked Questions
What is cointegration?
Two stocks are cointegrated if their price spread is mean-reverting — they may wander individually, but the spread oscillates around a stable average. This is the statistical foundation of pairs trading.
What is the hedge ratio?
The OLS beta: how many shares of B to short per share of A long (or vice versa) so the spread is market-neutral. Spread = A − β × B.
How do I trade the z-score?
Classic rules: enter when |z| > 2 (spread stretched), exit when z reverts to 0. Half-life tells you the typical holding period in bars.
Disclaimer: Simplified Engle-Granger-style heuristic for education — not a full ADF test with MacKinnon critical values. Past cointegration can break (corporate actions, regime shifts). Paper-trade before risking capital.
