PairScanner

Pair trading methods

The distance method

In plain words

The distance method finds pairs by comparing their paths: two stocks whose prices, rebased to the same start, stayed very close for months form a candidate pair. When their curves drift apart, you bet on them coming back together.

A pair trading signal, number by number

This is what a pair looks like in PairScanner. The stocks and the figures are fictional.

Click a number to learn its role

EXAMPLE A / EXAMPLE BPair tradingLONG A / SHORT Bfictional stock and figures
100105110115
EXAMPLE AEXAMPLE BNormalized prices, base 100
Z-score-2.4the gap is 2.4 times larger than usual

My role: measure how unusual the gap between the two stocks is. Beyond 2, positive or negative, the gap is rare: that is the entry zone. Here -2.4: A is unusually low against B.

CointegrationYesp-value 0.012

My role: tell you whether the link between the two stocks held over five years. Yes: the test confirms a pull between their prices. The lower the p-value, the more credible the link.

Out of sampleValidatedp-value 0.03 on the unseen period

My role: check that the link also held over a period the calculation had never seen. Validated: the link is not a fluke of the period studied.

Reversion86%25 of 29 past gaps, no fees

My role: tell you how often, in the past, a gap this large closed within 20 sessions. 86% over 29 cases: this pair tends to come back. This rate does not deduct fees.

Half-life7 sessionsto halve the gap

My role: give you an idea of the patience needed. 7 sessions on average for the gap to shrink by half: the position unwinds quickly.

Correlation0.92daily returns

My role: measure how closely the two stocks move together day to day. 0.92 out of a maximum of 1: they almost always move in the same direction.

What PairScanner does

Every evening after the US close, the algorithm tests thousands of pairs across more than 4,000 stocks, ETFs, currencies and cryptocurrencies. It shortlists assets whose returns are highly correlated, tests the cointegration of their prices over five years with the Engle-Granger method, and checks that the relationship also holds over a period the calculation has not seen.

For every pair, it then computes the Z-score of the gap, how often past gaps closed and how long they took. During the session, the Z-score refreshes about every 30 seconds from delayed quotes. For stocks, PairScanner also shows the context of the divergence: SEC filings and news activity.

You code nothing and calculate nothing: you open the pairs table, sort by gap, follow the pairs you like and get an alert when they cross your threshold.

Each pair’s charts also compare the paths rebased to 100, just like the distance method.

September 10, 2026

The calculation

Normalize each series to 1 at the start of the period: N(A,t) = P(A,t) / P(A,0). SSD distance is the sum of squared differences between the normalized series. Prices must be adjusted for corporate actions and compared on the same dates.

SSD = Σ [N(A,t) − N(B,t)]²

A numerical example

These values are fictional. The first asset goes from 100 to 104, then 103. The second goes from 50 to 51, then stays at 51. After normalization, the distance is 0² + 0.02² + 0.01² = 0.0005.

Fictional example: normalized paths
SessionAsset AAsset BSquared gap
01.001.000.0000
11.041.020.0004
21.031.020.0001

Reading the result

A lower distance means the price paths were closer over the selected period. There is no SSD threshold that works across all markets. The score depends on the number of observations and the normalization date, among other things: only pairs measured with the same protocol can be compared directly.

How the trade can generate a profit

Historical distance is used to select the pair. The trader then waits for the current gap between the normalized price paths to exceed a threshold set in advance. They buy the asset that has lagged and sell short the one that has moved ahead, aiming for the paths to move closer together.

Fictional example: consider two companies in the same market. A costs $100 and B costs $50. Later, A reaches $110 while B stays at $50: A has risen 10%, while B is unchanged. This difference is a statistical anomaly because these two stocks normally move together. The trader anticipates a return to normal and sells short 10 shares of A at $110 and buys 22 shares of B at $50, giving each leg a value of $1,100.

If A falls to $105 and B rises to $52.50, both assets are now 5% above their initial prices. The trader closes both positions: buying back A for less earns $50, and selling B for more earns $55. The total profit is $105 before fees, stock borrowing costs and any dividends owed on the short position.

What cointegration adds

Distance describes the proximity of normalized price paths. A cointegration test examines the stationarity of a combination of log prices, with an estimated hedge coefficient. These criteria answer different questions. That is why PairScanner relies on cointegration to validate every relationship.

Reference: Gatev, Goetzmann and Rouwenhorst, NBER Working Paper 7032 (1999). Their study matches stocks by minimum distance between normalized historical price paths. NBER.

PairScanner promises no results. Educational content: neither investment advice nor a prediction; PairScanner places no orders.

Compare real pairs

Free access during development. An email address is all you need.

Open PairScanner