Skip to content
All library documents

COSTAR Cointegration and Spread Analysis Strategy

Article Strategy library · Author: Steversteves

Summary

The visible source describes a two-asset strategy framework that compares one instrument with a user-selected pair. It retrieves closing prices on a selected timeframe, fits a rolling linear regression, and calculates correlation and residual error. The code then derives a spread-like series from the fitted value and price difference, and begins applying a Dickey–Fuller test to changes in that series. These components point to a cointegration-oriented approach that may be intended to identify relative-value opportunities.

The provided document is truncated partway through the subsequent calculations, so its complete signal rules, entry and exit conditions, and risk controls cannot be established. It includes display and backtest options, but no performance results or backtest settings are shown in the excerpt. The visible price retrieval specifies lookahead behavior, which can introduce forward-looking bias in historical analysis. Any assessment of the strategy’s validity or execution therefore requires the complete source and careful testing for data leakage.

Key ideas

  • The visible code compares two instruments using rolling linear regression and correlation calculations.
  • It constructs a spread-like series and begins testing its changes for stationarity.
  • The excerpt ends before full signal, position, and exit rules are visible.
  • No backtest results or performance evidence are included in the excerpt.
  • The specified lookahead behavior may create forward-looking bias in historical analysis.

Tags

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