Rolling Variance Pass Node
Rolling Variance — Series Input
Overview
The Rolling Variance Pass Node computes the rolling sample variance of any numeric series — the average squared deviation from the rolling mean. It is the squared standard deviation and a fundamental measure of dispersion.
Variance is used directly in portfolio optimisation (covariance matrices), model inputs requiring squared-scale dispersion measures, and as a building block for higher-order moments.
Formula
Parameters
| Parameter | Default | Description |
|---|---|---|
| period | 20 | Rolling window in bars |
Inputs & Outputs
| Slot | Direction | Type | Description |
|---|---|---|---|
| input | Input | { values, timestamps } | Any upstream numeric series |
| values | Output | (number | null)[] | Sample variance per bar; nulls during warm-up |
| timestamps | Output | number[] | Unix timestamps aligned to input |
Use Cases
Volatility Regime Detection
Track rolling variance of returns to identify low-variance (stable) vs high-variance (volatile) market regimes for position sizing.
Portfolio Optimisation Input
Rolling variance is the diagonal of the covariance matrix in mean-variance optimisation. Use alongside the Covariance node for full portfolio variance.
Normalised Signals
Divide signals by rolling variance (or std = √variance) to produce variance-normalised features for ML models or Z-score computation.
Tips & Best Practices
Variance vs StdDev
Variance is in squared units (e.g. squared percent). For human-readable volatility, use the square root (std deviation) or ATR-based measures instead.
Apply to Returns
Rolling variance of raw prices captures trend-induced dispersion. For true volatility analysis, compute variance on log-returns or simple returns.
Bessel Correction
This node uses the sample variance formula (÷ n−1). For population variance (÷ n), use when the window is the entire population of interest.