Cointegration Pass Node

Cointegration Score — Series Input

StatisticalMean ReversionPass

Overview

The Cointegration Pass Node measures the mean-reverting strength of any upstream numeric series over a rolling window. Inspired by the Engle-Granger cointegration test, it produces a score indicating how strongly the series tends to revert to an equilibrium.

Use it to validate that a spread or ratio series is truly cointegrated before applying mean-reversion strategies.

Formula

Rolling Engle-Granger-inspired score:
Regress Δx on x_{t-1} over the rolling window
Test for stationarity of the residuals
Higher score = more cointegrated (more mean-reverting) within the window.

Parameters

ParameterDefaultDescription
period20Rolling window in bars for cointegration scoring

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any upstream numeric series (spread, ratio, price)
valuesOutput(number | null)[]Cointegration score per bar; nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Pairs Trading Spread Validation

Confirm the spread between two assets is cointegrated before entering a pairs trade. High score = safe to trade.

Regime Detection

Monitor cointegration score over time to detect when a previously reliable mean-reverting relationship breaks down.

Mean Reversion Confirmation

Use as a gating condition for mean-reversion entries: only trade when cointegration score exceeds a threshold.

Tips & Best Practices

Combine with Half-Life

A cointegrated spread with short half-life (e.g. < 10 bars) offers both the statistical basis and speed needed for profitable mean reversion.

Works Best on Spreads

Most effective when the input is a price spread or ratio between two correlated assets, not raw prices.

Dynamic Monitoring

Cointegration can break down. Monitor the rolling score and exit positions when it drops below your threshold.

Related Indicators