Z-Score Pass Node

Rolling Z-Score — Series Input

StatisticalNormalisationPass

Overview

The Z-Score Pass Node computes the rolling standardised Z-score of a series — how many standard deviations the current value is above or below the rolling mean.

A Z-score of +2 means the current value is 2 standard deviations above the rolling mean, suggesting an extended deviation. A Z-score near 0 means the value is close to its recent average. This is one of the most widely used normalisation techniques in quantitative finance.

Formula

μ = mean(window)
σ = std(window)
Z[i] = (x[i] − μ) / σ
Returns null when σ = 0 (all values in window are identical).
Warm-up: period bars.

Parameters

ParameterDefaultDescription
period20Rolling window in bars

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any numeric series
valuesOutput(number | null)[]Z-score per bar; null during warm-up or when σ = 0
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Mean-Reversion Signals

Trigger trades when Z-score crosses extreme thresholds (e.g. ±2). High positive Z → overbought; high negative Z → oversold relative to the rolling window.

Cross-Asset Normalisation

Normalise multiple series to a common Z-score scale to compare indicators or assets with different magnitudes and volatilities.

Pair Trading

Compute Z-score of the spread between two cointegrated assets — enter when Z > +2, exit when Z returns to 0, short when Z < −2.

Tips & Best Practices

Assumes Normality

Standard Z-score assumes a normal distribution. Financial returns are typically fat-tailed. For outlier-resistant normalisation, use Z-Score Robust instead.

Window Length

Shorter periods (10–20) produce more reactive Z-scores, suitable for intraday. Longer periods (50–200) capture slower structural deviations, better for swing trading.

Null Handling

In flat markets or synthetic data with constant values, σ = 0 and the node returns null. Add a null-guard or default downstream before using Z-score in threshold comparisons.

Related Indicators