Distance-Based Pairs Trading with Formation and Reversion Signals
Summary
This implementation describes a distance-based statistical arbitrage method for forming and trading equity pairs. In a training period, each price series is scaled using its own minimum and maximum, and candidate pairs are ranked by the sum of squared differences between normalized prices. Pair selection can be restricted by industry or adjusted using zero-crossing counts or portfolio volatility. Missing observations are dropped for distance calculations, with a warning that unequal histories can distort the comparisons.
During trading, test prices are normalized with the training-period bounds to avoid using future data. The pair portfolio is the difference between the two normalized prices. A position is opened when this spread exceeds a chosen multiple of its training volatility and closed when the series cross at zero; the original example uses a two-standard-deviation entry threshold. This is a code implementation, not evidence of profitability. Its simple normalization and crossing rules do not establish cointegration, account for trading costs, or address execution and position sizing.
Key ideas
- Pairs are formed by minimizing squared differences between separately normalized training price series.
- The method can restrict matches by industry or rank pairs by zero crossings or spread volatility.
- Test observations are normalized using bounds calculated from the training period.
- The strategy enters when the normalized price difference crosses a volatility threshold and exits at zero.
- The implementation provides no performance evidence and does not model costs or establish stable pair relationships.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.