EN中文
Position Math

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

PairAnchor legHedge leg RatioZ-scoreCorrHalf-lifeRiskRelationship
Press “Scan” to load the cached daily data…
Ratio = hedge-leg notional ÷ anchor notional (≈1 = equal $) · spread = ln(anchor) − β·ln(other) − intercept · z = (spread − 120-day mean) ÷ 120-day std · entry ✅2.0σ ⚠️2.2σ ❌2.5σ, exit ±0.5σ
Manual tools — type the numbers, computed in your browser

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

Short shares of B (β-$-neutral)
Notional A / Notional B
Net $ exposure
Price spread A − β·B
Dollar-neutral means each leg carries the same $ notional (β scales how much B you short per $ of A).

2 · Spread z-score & signal

z-score
How extreme
Enter when |z| crosses the threshold; flatten when it falls back inside ±0.5σ.

3 · Two-leg position split

Leg A — long
Leg A notional
Leg B — short
Leg B notional
Splits gross capital so the two legs sit at the β notional ratio (β=1 → equal $, market-neutral).
Pairs trading, explained in three pictures

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?
It works out the three numbers a pairs trade needs: the hedge ratio that makes the two legs dollar-neutral, the spread z-score that tells you how stretched the pair is right now, and how to split capital across both legs. This page also runs a cointegration scanner that ranks how every instrument pairs with the one you choose.
How do I calculate the hedge ratio for a pair?
The hedge ratio β scales the short leg to the long leg. For a dollar-neutral hedge, short shares of B = β × (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.
What spread z-score should I enter a pairs trade at?
A widely used rule enters when the absolute z-score crosses about 2σ and exits when it falls back inside ±0.5σ. Cleaner, cointegrated pairs can use 2.0σ; weaker relationships need a more extreme reading (2.2–2.5σ) before they are worth the cost. A positive z means short the spread, negative means long it.
What does the cointegration badge mean?
✅ means the pair passed a cointegration test and reverts within a tradeable half-life — there is a spread edge. ⚠️ means they are only correlated, not cointegrated, so trade small. ❌ means correlation is too weak and the position is just a mechanical hedge with no edge. High correlation alone does not make a tradeable pair; the spread also has to mean-revert.
Is the pairs scanner real-time?
No. It uses delayed end-of-day (daily) data from Yahoo, cached on our server and refreshed daily, which is enough to judge a pair's structure before the session. It is for research, not execution — your actual fills and contract specs come from your own broker or prop firm.
Does this calculator give trading advice?
No. Everything here is an estimate from public data or the numbers you type. Pairs trading carries real risk — cointegration can break and both legs can lose at once. Verify sizes on your own platform and treat the output as education, not investment, trading, tax, or financial advice.

Related calculators

Funded-account checks

Use these three pages as a simple path: understand the rules, stress a scenario, then track consistency before a payout.

Information tool only. The manual tools are deterministic arithmetic from the numbers you enter. The pairs scanner reads delayed Yahoo daily data (cached server-side, refreshed daily) and runs a cointegration estimate — it is for research, not a trade signal, and connects to no account and stores nothing about you. Lot/contract sizes are estimates; verify on your own broker or prop firm before acting.
Disclosure. Some outbound links may be affiliate or partner links; they never change how a tool computes.