Skip to content
All library documents

Signals and Position Sizing for Multivariate Cointegration Trades

Code Stratmill research code

Summary

This module describes a trading rule built around a pre-estimated multivariate cointegration vector. It calculates the weighted sum of log prices, differences that series across recent observations, and uses the sign of the summed changes to set trade direction. Positive and negative vector coefficients determine the asset groups, while a target dollar investment is allocated across them and converted into whole-share quantities using current prices.

The code also tracks open trades and records their start and end prices when they are closed. Its comments recommend periodically re-estimating the cointegration vector and describe a one-trade-at-a-time approach in which a position is closed when the next entry arrives. The document provides implementation details, not empirical evidence of profitability. Its results depend on the quality and stability of the estimated vector, and the snippet does not explain transaction costs, execution, or safeguards for invalid prices and zero-sum coefficient groups.

Key ideas

  • The signal direction comes from the sum of recent changes in the cointegration error calculated from log prices.
  • The cointegration vector divides assets into positive and negative coefficient groups for long and short exposure.
  • A target dollar investment is translated into whole-share positions using the latest asset prices.
  • The module stores trade start data and records end prices when open trades are closed.
  • The code describes periodic vector re-estimation but provides no performance evidence or transaction-cost model.

Tags

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