Third-Party Research & Methodology Only

This section shares summaries of third-party academic research and descriptions of quantitative models. The content represents the findings of the original researchers, not the opinions or recommendations of Foxholm Financial. Foxholm Financial does not publish hypothetical or backtested performance metrics on its quantitative research pages. All content is restricted to methodology, signal construction, factor logic, and risk architecture. SEC rules require that investment advisers not present misleading performance data, and our methodology-only approach reflects that standard and the firm's fiduciary obligations.

Pairs Trading Algorithm

Statistical Market Neutral Mean Reversion
Robert Stowe
Robert Stowe, AAMS® Investment Advisor

Pairs trading is a market-neutral strategy that finds two securities whose prices historically move together, then profits when their relationship temporarily breaks down. When the spread between the two prices widens beyond its normal range, the strategy buys the underperformer and sells the outperformer, betting that the gap will close.

The strategy was pioneered in the mid-1980s by quantitative analysts at Morgan Stanley, led by Nunzio Tartaglia. The core appeal is that it removes most market-direction risk: because one position is long and the other is short, the portfolio is largely insulated from broad market moves. The profit comes from the relative performance of the two securities, not from whether the market goes up or down.

Conceptual Framework

Pairs trading rests on the idea that certain securities share common economic drivers. Two oil companies are affected by the same crude oil prices, two regional banks face similar interest rate environments, and two semiconductor firms respond to the same demand cycle. When their prices diverge without a fundamental reason, the divergence is likely temporary and will correct itself.

The mathematical foundation comes from the concept of cointegration, introduced by Nobel laureate Clive Granger. Two price series are cointegrated if they wander individually but maintain a stable long-run relationship. This is different from correlation: two stocks can be highly correlated (they move in the same direction day to day) but not cointegrated (they can drift apart permanently over time). Cointegration is a stronger condition that implies the spread between the two prices will revert to a stable mean.

Core Assumptions

Pairs trading models make several assumptions about how the paired securities behave. Each creates risk when reality diverges:

  • The relationship is stable: The model assumes that the statistical relationship between the two securities will persist into the future. In practice, companies diverge permanently due to mergers, regulatory changes, competitive shifts, or management decisions. A pair that has moved together for five years can break apart permanently if one company's fundamentals change.
  • Divergences are temporary: When the spread widens, the model assumes it will revert to its historical mean. This fails when the divergence reflects a genuine, lasting change in relative value rather than a temporary overreaction.
  • Both legs can be executed: The strategy requires simultaneously buying one security and short-selling another. Short selling requires borrowing shares, which may not be available or may become expensive during market stress. If one leg cannot be executed, the supposedly market-neutral position becomes a directional bet.
  • Transaction costs are manageable: Pairs trading involves four transactions per round trip (opening and closing both legs). Bid-ask spreads, commissions, and the cost of borrowing shares for the short position all reduce the net profit. The strategy only works if the expected spread convergence exceeds these costs.

Signal Construction

Building a pairs trading strategy follows a structured pipeline from identifying candidate pairs to executing trades and managing risk.

Step 1
Pair Identification
Step 2
Cointegration Testing
Step 3
Spread Modeling
Step 4
Entry & Exit Rules
Step 5
Position Management

Pair Identification

The first step is finding securities that are likely to maintain a stable relationship. The most common approach starts with an economic filter: select stocks from the same industry, sector, or supply chain. Two companies that mine copper, two airlines that fly similar routes, or a retailer and its primary supplier all have economic reasons to move together.

Starting from economic logic is important because purely statistical pair selection (screening thousands of random pairs for high correlation) tends to find spurious relationships that do not persist. Two unrelated stocks may have moved together by coincidence over the past year, but there is no reason to expect the relationship to continue. Pairs with a clear economic link are more likely to revert when they diverge.

Cointegration Testing

Once candidate pairs are identified, statistical tests determine whether the spread between them is mean-reverting. The two most common tests are the Engle-Granger two-step method and the Johansen test.

The Engle-Granger method works in two steps. First, regress one stock's price on the other to estimate the hedge ratio (how many shares of stock B to trade for each share of stock A). Second, test whether the residuals from this regression (the spread) are stationary, meaning they fluctuate around a constant mean rather than drifting over time. The Augmented Dickey-Fuller (ADF) test is the standard method for checking stationarity. A stationary spread means the pair is cointegrated and suitable for trading.

Spread Modeling and Signal Generation

With a cointegrated pair identified, the spread is calculated as the difference between the actual prices and the equilibrium implied by the hedge ratio. This spread is then standardized into a z-score: the number of standard deviations the current spread is above or below its historical mean.

Common entry and exit thresholds include:

  • Entry signal: Open the trade when the z-score exceeds +2.0 or falls below -2.0. At +2.0, sell the outperformer and buy the underperformer. At -2.0, do the reverse.
  • Exit signal: Close the trade when the z-score returns to zero (the spread has fully reverted) or crosses a tighter threshold like +0.5 / -0.5 to lock in partial profits.
  • Stop loss: Close the trade if the z-score reaches +3.5 or -3.5, indicating the spread has widened further and the pair may have broken down.

The Hedge Ratio

The hedge ratio determines the relative size of the long and short positions. If stock A costs $100 and stock B costs $50, a simple dollar-neutral approach would buy 1 share of A and short 2 shares of B. More sophisticated approaches use the regression coefficient from the cointegration test, which accounts for the historical relationship between the two prices. The hedge ratio must be recalculated periodically because the relationship between the two securities changes over time.

Risk Architecture

Pairs trading is often described as "market neutral," but this label can be misleading. While the strategy removes most broad market risk, it introduces its own set of risks that can produce significant losses.

Model Risk

The greatest risk is that the cointegrated relationship breaks down permanently. This can happen when one company is acquired, faces a regulatory change, loses a major customer, or undergoes a fundamental shift in its business model. The strategy is short the outperformer and long the underperformer, so a permanent divergence means the losing side keeps getting worse while the winning side fails to recover. Unlike a simple long position that can only go to zero, the short leg of a pairs trade has theoretically unlimited loss potential.

A second risk is that the spread widens before it narrows. Even if the pair ultimately converges, the spread may move against the position for days, weeks, or months before reverting. This creates mark-to-market losses that can force liquidation at the worst possible time, especially if the strategy uses leverage.

Known Limitations

Limitations to Consider

  • Pair breakdown risk: Cointegrated relationships can end permanently due to mergers, bankruptcies, regulatory changes, or competitive shifts. The model cannot predict these structural changes.
  • Short selling constraints: Borrowing shares for the short leg may become expensive or impossible during market stress, exactly when spreads tend to widen the most. Short squeezes can force liquidation at unfavorable prices.
  • Lookback sensitivity: The cointegration test results depend on which historical period is used. A pair that tests as cointegrated over 3 years may not be cointegrated over 5 years, and vice versa. There is no universally correct lookback period.
  • Multiple testing problem: Screening hundreds or thousands of potential pairs for cointegration will find some pairs that pass by chance alone. Without adjustment for the number of tests performed, the false positive rate is high.
  • Execution risk: The strategy requires simultaneous execution of both legs. If one leg fills and the other does not (due to a halt, illiquidity, or price movement), the supposedly hedged position becomes a naked directional bet.
  • Crowding: Pairs trading is well-known among quantitative traders. When many participants trade the same pairs with similar signals, the competition erodes profits and can cause correlated losses when pairs break down simultaneously.

Practical Considerations

Building a Pair Universe

A robust pairs trading program does not rely on a single pair. Instead, it maintains a portfolio of 10 to 50 active pairs, diversified across sectors and industries. This diversification is essential because any individual pair can break down at any time. If the portfolio is concentrated in a few pairs, a single breakdown can wipe out months of accumulated profits.

The pair universe should be refreshed periodically (typically monthly or quarterly) by re-running cointegration tests and removing pairs that no longer pass. New candidate pairs should be added as they emerge. This ongoing maintenance is a significant operational burden but is necessary to keep the strategy current.

Sector and Industry Effects

Some sectors produce better pairs than others. Sectors with commodity exposure (energy, mining, agriculture) tend to produce strong pairs because the companies share a dominant price driver. Regulated industries (utilities, banking) also produce good pairs because regulatory frameworks create similar business models. Technology companies tend to produce weaker pairs because individual company outcomes vary widely even within the same sub-sector.

Transaction Cost Management

Pairs trading is transaction-cost intensive. Each round trip involves four trades (open long, open short, close long, close short), plus the ongoing cost of borrowing shares for the short position. The expected profit per trade is often small (1-3% of the notional value), so even modest transaction costs can consume a large fraction of the expected return. Practical implementations use limit orders, minimize unnecessary rebalancing, and focus on liquid securities with tight bid-ask spreads to keep costs manageable.

Further Reading

Meet with a Fiduciary Advisor

Foxholm Financial is a fee-only registered investment adviser serving Georgia. We bring quantitative rigor to every client engagement. Explore our services or get in touch to discuss how we can help.

Institutional Clients

Are you an institution or FinTech firm? Learn about our Quantitative Consulting Services.

Disclaimer

This content is for educational and informational purposes only and does not constitute an offer to sell or a solicitation of an offer to buy any securities. Nothing herein constitutes investment advice or recommendations tailored to your individual situation. All investments involve risk, including the potential loss of principal. Past performance is no guarantee of future results. Information presented is believed to be factual and up-to-date, but Foxholm Financial does not guarantee its accuracy and it should not be regarded as a complete analysis of the subjects discussed. Before making investment decisions, consult with a qualified financial advisor who can evaluate your specific circumstances.

On This Page