Rolling PCA Pass Node
Rolling PCA — First Principal Component
Overview
The Rolling PCA Pass Node applies Principal Component Analysis to a rolling window of a single series, projecting it onto its first principal component. The result captures the dominant linear variation structure within the window.
In the single-series case, the first PC is equivalent to a normalised projection capturing the cumulative variance pattern. This is most powerful when extended to multi-series inputs for factor extraction and dimensionality reduction.
Formula
Parameters
| Parameter | Default | Description |
|---|---|---|
| period | 30 | Rolling window in bars |
Inputs & Outputs
| Slot | Direction | Type | Description |
|---|---|---|---|
| input | Input | { values, timestamps } | Any upstream numeric series |
| values | Output | (number | null)[] | First PC score per bar; nulls during warm-up |
| timestamps | Output | number[] | Unix timestamps aligned to input |
Use Cases
Dominant Trend Extraction
The first PC captures the dominant direction of variation in the window — useful as a smooth, orthogonal trend signal.
Regime Detection
Monitor changes in PC1 loadings over time to detect shifts in the structure of price dynamics — leading indicator of regime change.
Noise Reduction
Project a noisy series onto its first PC to extract the signal component, filtering out random noise within the rolling window.
Tips & Best Practices
Sign Flip Awareness
PC1 eigenvectors can flip sign between windows. This causes sign ambiguity in the output — apply careful sign correction or use absolute values if the direction doesn't matter.
Use Larger Windows
PCA is noisy with small samples. Use period ≥ 30 for meaningful results. Period = 60 or more is preferred for stable eigenvectors.
Combine with Hurst or DFA
Use PCA output alongside Hurst Exponent or DFA to confirm whether the extracted component is trending or mean-reverting.