A pairs trading strategy, step by step: selection, entry, exit and stops
Most explanations of pairs trading stop at "buy the cheap one, sell the expensive one". A strategy you can actually test needs more than that: a way to pick candidates, a rule for when a gap is wide enough, a rule for when it has closed, and a rule for when you were wrong. This guide walks through each piece in the order a systematic trader would build it.
1. Start from an economic reason
Search every possible combination of a few hundred assets and you will find thousands of pairs that look cointegrated by pure chance. Start instead from pairs that have a reason to move together: two companies selling the same product to the same customers, two ETFs holding similar baskets, two coins with a shared ecosystem. Coca-Cola and PepsiCo, Exxon and Chevron, or two gold ETFs are classic examples. Grouping by sector or fund family also keeps the number of tests small, which matters for the next step.
2. Test the relationship
For each candidate, estimate the hedge ratio β with a regression of log prices, build the spread and test whether it is stationary. The usual tools are the Engle–Granger and ADF tests. Because you are running many tests, correct for multiple testing: a p-value of 0.04 means little when it is the best of 200 attempts. Add practical filters on top of the statistics:
- a positive hedge ratio (both legs move in the same direction),
- a half-life short enough to be useful, for example 1 to 40 days,
- a Hurst exponent below 0.5, a second hint of mean reversion.
3. Size the two legs
The hedge ratio tells you how much of B offsets one unit of A in log terms. In money, a common approach is to put a fixed amount on leg A and β times that amount on leg B, in the opposite direction. If β is 0.8 and you allocate $10,000 to the long leg, the short leg is about $8,000. More on this in how to calculate the hedge ratio.
4. Entry: when is the gap wide enough?
Convert the spread to a z-score with a trailing mean and standard deviation. A typical rule opens a position when |z| reaches 2: short the spread (sell A, buy B) when z is above +2, long the spread (buy A, sell B) when z is below −2. Lower levels give more trades with smaller expected gains; costs push the sensible level up.
5. Exit: when has it closed?
The natural exit is a return toward the mean, for example |z| at or below 0.5. Waiting for exactly zero gives back part of the gain on spreads that hover just above it. Some traders also add a time exit: if the trade is still open after three or four half-lives, the estimate of mean reversion was probably wrong.
6. Stops: when were you wrong?
Mean reversion strategies win often and lose rarely but heavily. The rare loss is usually a relationship that broke: a merger, a lawsuit, a change of business model. Two kinds of stop help:
- A price stop, such as |z| beyond 3.5. Under a normal distribution this is extremely rare, so reaching it is more likely a sign of change than of opportunity.
- A statistical stop: re-run the cointegration test as new data arrives and close the position if the p-value rises well above your threshold, for example 0.20.
After a stop, a cool-down rule (no new entry until |z| falls back below the entry level) keeps the strategy from re-entering a broken pair over and over.
7. Test it honestly
Put the rules together and run them walk-forward, with next-bar fills and costs on all four transactions. Read backtesting without fooling yourself before trusting any result.
How Arbitrading fits
Arbitrading runs steps 1, 2 and 4 to 6 every day for 276 candidate pairs in stocks, ETFs and crypto, lets you backtest your own entry, exit and stop levels, and alerts you when a spread crosses them. It never places orders and does not tell you what to trade: the levels and the decisions are yours.