Calculators › Pairs trading
Pairs Trading Calculator
The pairs trading calculator finds the hedge ratio that makes two legs dollar-neutral, reads the spread z-score for entries and exits, and splits capital across both legs — backed by a cointegration scanner that ranks how every instrument pairs with the one you want to trade. It runs in your browser and connects to no account.
Pairs trading bets on two correlated instruments converging: it measures the spread between them as a z-score (how many standard deviations the spread sits from its mean) and sizes each leg so the position is market-neutral, aiming to profit when the spread reverts toward its average.
Live pair scanner — pick one instrument, see every pairing
| Pair | Anchor leg | Hedge leg | Ratio | Z-score | Corr | Half-life | Risk | Relationship | |
|---|---|---|---|---|---|---|---|---|---|
| Press “Scan” to load the cached daily data… | |||||||||
No connection needed. Use these to learn the math behind the scanner, or to size a pair when you already have your own β and spread statistics.
1 · Hedge ratio & spread
2 · Spread z-score & signal
3 · Two-leg position split
The whole idea in a minute — no math needed. The interactive charts above are these three ideas, run on delayed daily data.
1 · Why two legs, not one
Long one leg, short the other. When the market drops, your long loses but your short gains — the market move roughly cancels. What is left is the spread: the gap between the two. That gap is the only thing you are betting on.
2 · Stretch, then snap back
Measure the spread as a z-score — how many standard deviations it sits from its own average. When it stretches past ±2σ (the red zone) you fade it; when it snaps back inside ±0.5σ (the green zone) you are flat. You are selling the rubber band when it is stretched.
3 · Correlation is not enough
Two things can move together for years and still drift apart forever — that is just correlation, no edge (❌). A real pair is cointegrated: the spread keeps coming home (✅). The scanner tests for exactly that, which is why most pairs honestly score ⚠️ or ❌.
Newsletter
Get the weekly position-sizing playbook
One email a week: macro & US markets, gold, futures & crypto — plus prop-firm rules, risk math and new calculators. No spam, unsubscribe anytime.
How it works
What this page does
Pairs trading bets that two related instruments, which usually move together, will snap back toward their normal relationship after they drift apart. You go long one leg and short the other, so broad market direction roughly cancels and you trade the spread between them. This page has a pairs scanner plus three manual calculators.
The pairs scanner
Pick an anchor — the instrument you actually want to trade — and how many lots or shares you intend to put on it. The scanner pulls daily prices for a basket of major FX pairs, metals, energy, indices, big tech stocks and BTC, then for each pairing it estimates the hedge ratio, the spread, its z-score, the rolling correlation, the mean-reversion half-life, and the size for the other leg. Every row carries an honest relationship badge:
- ✅ real pair — cointegration confirmed and the half-life is in a tradeable band, so the spread has historically mean-reverted (there is an edge to trade).
- ⚠️ weak — the two are correlated but cointegration did not pass or the spread reverts too slowly; size small and lean on discipline.
- ❌ none — correlation is too weak; the numbers only balance the legs mechanically, there is no spread edge to harvest.
Zero ✅ rows is normal — genuine cointegration is rare and fragile. The scanner reads delayed Yahoo daily data cached on our server (refreshed daily); it is research, not a trade signal, and connects to no account.
1 · Hedge ratio & spread
The hedge ratio β sets how much of leg B you short per dollar of leg A. With β = 1 the two legs carry equal dollar notional — dollar-neutral. Short shares of B come from β × (shares_A × price_A) / price_B, and the price spread shown is A − β·B. The scanner's spread is the log version, ln(A) − β·ln(B) − intercept, fitted by an Engle–Granger cointegration regression.
2 · Spread z-score & signal
The z-score says how far today's spread sits from its recent average, in standard deviations: z = (spread − mean) / std. The bigger the absolute value, the more stretched the pair. A common rule enters when |z| crosses a threshold (2.0σ for the cleanest pairs, higher for weaker ones) and flattens once it falls back inside ±0.5σ. A positive z means the spread is rich (short it); negative means cheap (long it).
3 · Two-leg position split
Given the capital you want deployed gross, it splits across the two legs at the β notional ratio: A notional = capital / (1 + β) and B notional = capital × β / (1 + β), then converts each to a share or lot count at the prices you enter. At β = 1 the split is even and market-neutral.
A worked example
Suppose gold (XAUUSD) and silver (XAGUSD) usually move together and the scanner marks them ✅ with β ≈ 0.9 and a half-life of about 8 days. Today the spread reads +2.3σ — gold is rich relative to silver. The play is to short the spread: short gold, long roughly β dollars of silver per dollar of gold, sized so both legs carry similar risk. You hold until the z-score falls back inside ±0.5σ (history says that takes a week or two here), or you cut it if it pushes past your stop. Had the two only been correlated — not cointegrated — that +2.3σ could keep widening indefinitely; that is precisely the trade the ⚠️/❌ badges steer you away from. The spotlight charts above show this exact picture for whichever pair you click.
What it deliberately does not do
It will not promise the spread reverts — cointegration breaks, especially around earnings or regime shifts, and after costs the edge in pairs trading is thin. Lot and contract sizes are estimates; the robust outputs are the ratio and the spread statistics, not a share count down to the decimal. This is an information tool for education, not investment advice.
Frequently asked questions
What is a pairs trading calculator?
How do I calculate the hedge ratio for a pair?
β × (shares_A × price_A) / price_B; with β = 1 each leg carries the same dollar notional. The pairs scanner estimates β statistically from an Engle–Granger cointegration regression on the two price series.