I keep seeing people pick pairs off a correlation heatmap, and it drives me a little crazy, because correlation is answering a question you did not ask. When you trade a spread, you are betting that the gap between two assets keeps snapping back to some equilibrium. Correlation says nothing about whether that gap comes back. It only tells you the two assets tended to move in the same direction on the same days. Those are different properties, and confusing them is how you end up long a spread that just drifts away from you forever.
Here is the trap in one sentence. Two assets can be highly correlated and still walk apart indefinitely, and two assets can be barely correlated day to day while their spread reliably mean-reverts. If the second sentence sounds wrong to you, that is exactly the intuition worth fixing.
Why correlation is the wrong tool
Correlation is a measure of returns moving together, and it is scale-free and memoryless in a way that hides the thing you care about. Imagine two random walks that both drift upward at roughly the same speed. Their daily returns can look tightly correlated, so a heatmap lights up green. But the distance between their price levels is itself a random walk. It can wander off to any value and never return. You would be trading a spread with no anchor.
Cointegration asks the opposite question. It looks at the price levels, not the returns, and it tests whether some linear combination of the two, the spread, is stationary. Stationary is the technical word for the property you actually want, which is that the series has a stable mean and keeps pulling back toward it. A cointegrated pair can have two prices that individually wander all over the place, and yet a specific weighted difference of them stays disciplined. That weighted difference is your tradeable object.
The cleanest mental model I use is a drunk walking a dog. Both wander. The dog is not correlated with the human's stride in any tick-by-tick sense. But the leash means the distance between them stays bounded, and when the dog gets too far out it gets pulled back. Correlation looks at the footsteps. Cointegration looks at the leash.
Cross-asset examples that make it click
Gold miners versus gold is the one everyone reaches for, and for good reason. A basket of miners is, very roughly, leveraged exposure to the gold price minus a pile of operating costs and hedging noise. Over long stretches the two are tied together by an economic tether, so the spread has something to revert to. But notice the tether is economic, not statistical decoration. When energy costs spike or a major miner blows up a hedge book, the relationship can genuinely change, and that is a feature of the example, not a flaw. It forces you to have a story for why the pair should be linked.
ETH versus BTC is the crypto version. On any given day the two are strongly correlated, because when the whole market catches a bid or gets liquidated, everything moves together. That high correlation tempts people into trading the ratio. Sometimes the ratio does mean-revert around a regime, and sometimes it just trends for months as capital rotates from one to the other. Correlation stayed high the entire time and told you nothing about which of those two worlds you were in. Only a stationarity test on the spread, run on a rolling basis, has a shot at distinguishing them.
A workflow you can actually run
You do not need anything exotic. This is a half-page of code in Python with statsmodels, or a few clicks in any stats package. The steps matter more than the tooling.
- Start with an economic reason the pair should be linked. Same commodity, same sector, one asset being a claim on the other. If you cannot say the reason out loud, stop here. A test that passes without a reason is usually data mining.
- Pull a few years of aligned price history, use log prices, and make sure your timestamps line up. Misaligned bars quietly break everything downstream.
- Run an Engle-Granger test. Regress one log price on the other to get the hedge ratio, take the residual as your spread, and run an augmented Dickey-Fuller test on that residual. A low p-value is your evidence the spread is stationary. For portfolios of more than two legs, reach for the Johansen test instead.
- Look at the spread by eye anyway. Plot it. You want something that crosses its mean often and looks like it has a rubber band, not a slow ramp. Estimate the half-life of mean reversion from an Ornstein-Uhlenbeck fit so you know roughly how long a round trip takes. If the half-life is longer than your patience or your holding horizon, the statistics do not matter.
- Only then think about entry and exit bands, usually in units of the spread's standard deviation, and size the position with the hedge ratio you estimated, not a naive one-to-one.
One rule of thumb I hold onto. Test the relationship out of sample before you trust it. Fit the hedge ratio on one window, then check that the spread is still stationary on a later window you did not touch. Plenty of pairs are cointegrated in-sample and fall apart the moment you step forward, which is the whole reason the discipline exists.
Knowing when a spread has broken
A cointegrated relationship is not a law of physics. It is a statistical fact about a period, and periods end. Mergers, index reconstitutions, a token changing its issuance schedule, a commodity producer restructuring, all of these can sever the tether permanently. The failure mode that hurts is not a spread that overshoots your band. It is a spread that overshoots and keeps going, because the equilibrium you were reverting to no longer exists, and you keep adding to a loser that is now just a trend.
So I monitor a few things continuously rather than trusting the original test forever.
- Re-run the stationarity test on a rolling window. If the p-value has quietly climbed and stopped clearing your threshold, treat that as the relationship weakening, not noise.
- Watch the hedge ratio itself. If the ratio you re-estimate each period is drifting steadily in one direction rather than wobbling around a stable value, the structure is changing under you.
- Set a hard stop in units of spread standard deviation or in time. A spread that has sat beyond its historical range far longer than your estimated half-life is telling you the mean moved. Believe it.
- Keep a short list of structural events per leg. A known corporate action or protocol change is reason enough to flatten and re-test from scratch, no matter how good the spread looked yesterday.
The honest summary is that correlation is a screening convenience and cointegration is the actual entry criterion, and even a clean cointegration test is a hypothesis with an expiry date rather than a guarantee. I run these spread checks alongside the market scorecards and backtests inside Blockcircle, mostly so the monitoring is automatic and I am not the one who forgets to re-run the test. Whatever tooling you use, the habit that saves you is boring. Have a reason, test out of sample, and keep asking whether the leash is still there.