Mean Reversion Score Pass Node

Mean Reversion Score — Series Input

StatisticalMean ReversionPass

Overview

The Mean Reversion Score Pass Node combines a rolling Z-score with autocorrelation analysis to produce a composite mean-reversion signal. A high positive score indicates the series is stretched above its mean and likely to revert; a high negative score indicates the opposite.

This node is ideal as a single-indicator mean-reversion filter, combining the deviation signal (Z-score) and the serial correlation structure (autocorrelation) into one output.

Formula

Composite Score:
Z = (x − mean(window)) / std(window)
ρ = autocorrelation(window, lag=1)
score = Z × (1 − ρ)   [strengthened when negative autocorrelation]
High score = above mean + mean-reverting autocorrelation → fade signal. Low score = below mean + mean-reverting → buy signal.

Parameters

ParameterDefaultDescription
period20Rolling window in bars for both Z-score and autocorrelation

Inputs & Outputs

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

Use Cases

Mean Reversion Entry Signal

Enter short when score > threshold (e.g. +2) and long when score < −threshold. Uses both deviation and reversal tendency.

Single-Node Mean Reversion

Combines Z-score + autocorrelation into one signal, reducing the need to wire multiple nodes for a simple mean-reversion strategy.

Spread Trading

Apply to a cointegrated spread series for a ready-to-use entry signal that adapts to the current reversal dynamics.

Tips & Best Practices

Use on Mean-Reverting Series

This node is most effective when applied to spreads or residuals confirmed to be cointegrated — not on raw trending prices.

Verify with Half-Life

Combine with the Half-Life Pass node to ensure your hold period aligns with the reversion speed of the series.

Score Magnitude Varies by Input

The score scale depends on the input series. Normalise or backtest to determine appropriate threshold values for your data.

Related Indicators