Autocorrelation Pass Node

Autocorrelation — Series Input

StatisticalPass

Overview

Measures the serial correlation of any upstream numeric series at a user-defined lag. A value near +1 means the series tends to continue in the same direction; near -1 means it reverses; near 0 means no linear relationship between consecutive values.

Unlike the base Autocorrelation node which reads closing prices from a root stock node, this Pass variant accepts any { values, timestamps } input — making it applicable to indicator outputs, spreads, or custom signals.

Formula

ρ(lag) = Σ[(xᵢ - μ)(xᵢ₋ₗₐg - μ)] / (N × σ²)
Computed over a rolling window of period bars, then stepped forward one bar at a time. Output range: −1 to +1.

Parameters

ParameterDefaultDescription
period20Rolling lookback window size in bars
lag1Number of bars back to correlate against

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any upstream numeric series
valuesOutput(number | null)[]Autocorrelation values (−1 to +1); nulls during warm-up
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Mean Reversion Detection

Negative lag-1 autocorrelation signals mean-reverting behaviour — use as a filter before applying mean-reversion strategies.

Trend Confirmation

High positive autocorrelation (≥ 0.7) suggests a persistent trend; combine with a momentum indicator for entry.

ML Feature Engineering

Feed autocorrelation at multiple lags as features into a machine-learning model to capture temporal structure.

Tips & Best Practices

Lag=1 Most Common

Lag-1 captures the strongest serial dependence. Increase lag to study longer-range dependence patterns.

Warm-up = period + lag

The first period + lag bars will be null. Ensure sufficient historical data.

Normalise Before Using

Apply Z-Score Pass to autocorrelation output to get a signal normalised for current regime.

Related Indicators