Why? We're finding the linear relationship. β tells us "for every 1moveinB,Amoves\beta$ dollars on average."
Step 2: Construct the spread
S(t)=PA(t)−βPB(t)−α
Why subtract α? To center the spread around zero. Now S(t) represents the deviation from the long-run relationship.
Step 3: Test if S(t) is stationary
Use the ==Augmented Dickey-Fuller (ADF) test==. Null hypothesis: "S has a unit root (non-stationary)." If we reject (p-value < 0.05), S is stationary → the pair is cointegrated.
Why Z-score? It's unit-agnostic (works whether stocks are 10or1000) and probabilistic: ∣Z∣>2 happens ~5% of the time if S is Gaussian.
Interpretation: Spread is 1.75 standard deviations above mean. Not quite at our +2 threshold, so we wait.
Next day: KO jumps to 62,PEPstays180.
S=62−0.32×180=4.4,Z=0.84.4−1.0=4.25
Action: Short 100 shares of KO, long 32 shares of PEP (to match the β=0.32 ratio). Our exposure: neutral to market moves, only profits from spread converging.
Why this step? When the spread is abnormally wide, KO is overpriced relative to PEP. We expect mean reversion.
Exit: When Z drops below 0.5, close both legs. If it never happens (spread diverges forever), we eat a loss—hence the need for stop-losses.
For a basket of n>2 stocks, use the ==Johansen test==. It finds all cointegrating relationships simultaneously via eigenvalue decomposition of the error-correction matrix.
Why? With 3+ stocks, there might be multiple cointegrating vectors (e.g., A-B cointegrated, B-C cointegrated → A-C cointegrated by transitivity). Johansen catches them all.
Similar market cap (avoid pairing mega-cap with small-cap).
High correlation + passing ADF test.
In-Sample Testing:
Use first 70% of data to estimate β, μS, σS.
Out-of-Sample Validation:
Test on remaining 30%. Did historical Z-scores predict actual reversions?
Risk Management:
Stop-loss if ∣Z∣>4 (spread diverging, not reverting).
Max hold period (e.g., 30 days).
Position sizing: never risk > 2% capital per pair.
Execution:
Enter simultaneously (market orders → slippage risk).
Monitor for earnings, dividends, corporate actions (break cointegration).
Recall Explain Like I'm 12
Imagine two best friends, Alice and Bob, who always share their Halloween candy 50-50. One day, Alice ends up with 80 pieces, Bob with 40. That's weird! You bet that by next week, they'll share more evenly again—maybe Alice gives some to Bob, or Bob trades for more. That's pairs trading: when two things that usually stick together get too far apart, you bet they'll come back together. Cointegration is the math way of saying "these two friends always end up balancing out, even if they drift apart for a bit."
What is cointegration in pairs trading? :: Two non-stationary price series are cointegrated if their linear combination (spread) is stationary (mean-reverting), allowing us to trade the spread.
How do you calculate the hedge ratio β in pairs trading?
Run an OLS regression Y = α + βX + ε. The slope β tells you how many units of X to trade per unit of Y to create a market-neutral position.
What does a Z-score > +2 signal in pairs trading?
The spread is abnormally wide (2 std devs above mean) → short the outperformer, long the underperformer, expecting mean reversion.
Why can't you rely on correlation alone for pairs trading?
High correlation means co-movement but doesn't guarantee the spread is mean-reverting. Two stocks can correlate yet diverge permanently. Cointegration (tested via ADF) is required.
What is the ADF test and why do we use it?
Augmented Dickey-Fuller test checks if the spread has a unit root (non-stationary). Rejecting the null (p < 0.05) confirms the spread is stationary → pair is cointegrated.
How do you construct the spread in pairs trading?
S(t) = P_A(t) - β P_B(t) - α, where β is the hedge ratio from regression and α centers the spread around zero.
When should you exit a pairs trade?
When |Z| < 0.5 (spread returned to mean) or if a stop-loss is hit (|Z| > 4, indicating divergence instead of reversion).
What is the half-life of mean reversion and why does it matter?
Time for the spread to decay halfway back to its mean. If too long (>30 days), capital is tied up inefficiently. Calculate via AR(1): half-life = ln(0.5)/ln(φ).
Why must pairs be from the same sector?
They share economic drivers (oil prices for energy, interest rates for banks). Different sectors may correlate by chance but lack fundamental linkage → cointegration breaks.
Why is the hedge ratio β different from relative volatility?
β is the OLS regression slope capturing average dollar-for-dollar co-movement in the cointegrating relationship; volatility measures the size of random fluctuations. Size legs by β, not by a volatility ratio.
Pairs trading ek statistical arbitrage strategy hai jisme ap do related stocks ka spread trade karte ho. Socho Coca-Cola aur Pepsi – dono beverage companies hain, similar business model hai. Agar inke prices normally sath chalte hain (cointegrated hain), lekin ek din Coke zyada upar chala gaya aur Pepsi peeche reh gayi, toh aap bet karte ho ki ye gap close hoga. Aap Coke ko short karo (becho) aur Pepsi ko long