Skip to content
All library documents

Why Pair-Trade Z-Scores Change When the Stock Order Is Reversed

Article Quant Q&A · Author: Don Chambers

Summary

The document examines a practical issue in pairs trading: reversing which security is treated as the dependent variable can change the estimated hedge ratio and produce very different spread values and z-scores. The author illustrates the problem by fitting a slope to five observations, forming a residual spread, and then comparing hypothetical trade entry and exit calculations under both stock orderings. In the first ordering, the example suggests a profitable convergence trade; after swapping the securities, the reported z-score moves sharply away from the expected exit level.

The central lesson is that ordinary regression is directional: regressing Y on X generally does not produce the reciprocal of regressing X on Y. Consequently, residual spreads and standardized signals need not be invariant when the securities are swapped. The post raises the issue but does not provide an answer or establish a validated trading method. It also gives only a tiny illustrative sample, so it cannot show that either signal is reliable or profitable in live trading.

Key ideas

  • Regression-based hedge ratios depend on which security is designated as the dependent variable.
  • Reversing the pair can materially change the residual spread and its z-score.
  • A small worked example illustrates the order sensitivity but does not validate a trading rule.
  • The post leaves the choice of hedge-ratio method unresolved.

Tags

Full text
# Pair Trade - Should stock order matter


# Pair Trade - Should stock order matter












I am testing a simple pair trading algorithm and I'm having problems if I swap the stocks around. I don't know which stock should be X and which should be Y. When I swap them I get very different results.

I would expect the returns to the be the same when swapped. I may want to long an spread, and if I swap them around would want to short it. Since I swapped, I should still be longing and shorting the same securities.

Here is a tedious example that I worked up in excel:

```
    X      Y

164.603 155.845
166.226 156.417
168.312 159.387
164.908 155.588
166.571 156.614
```

I calculate the slope as slope(y1:y5, x1,x5) which gives me a hedge factor of 0.963. Then I create a spread for each value with the formula Y-hedge*X, which gives me this series:

```
-2.668778868
-3.659738615
-2.698570426
-3.219495888
-3.794975899
```

The mean of this series is -3.208 and the standard deviation is 0.52417.

Assume X moves to 164 and y moves to 154. Now my spread value is -3.93309. This gives me a Z value of -1.38271. I want to long Y and short X. I want to exit when the zscore returns to near zero. Assume X moves to 163.40 and Y moves to 154.19. My new zscore is 0.08. So I exit the trade with a profit. (my long went up and my short went down).

Now if I swap X and Y the hedge factor changes, and the mean of my spread is vastly different (16.6 vs -3.2). When X moves to 154 and y moves to 164 (same as above but swapped) the zscore is 2.13. I would want to sort Y and long X, but since I swapped the order I am longing and short the same as before. Now when X moves to 154.19 and Y moves to 163.40 my zscore moves to 48.03. I don't exit - I am waiting for it to return to near zero.

I think I am missing something simple.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.