Rolling SSA Oscillator [LuxAlgo]The Rolling SSA Oscillator indicator is a cycle-analysis tool that utilizes Singular Spectrum Analysis (SSA) to decompose price action into its most significant periodic components, providing a real-time view of underlying market rhythms. Unlike traditional lagging oscillators, this script uses eigendecomposition to isolate dominant trends and noise-reduced oscillations for better market timing.
🔶 USAGE
The indicator provides two primary components derived from the price's spectral signature: a Long-Term Periodic component and a Short-Term Periodic component. These can be used to identify trend direction, cyclical reversals, and momentum exhaustion.
🔹 Trading Signals
Trend Direction: When the Long-Term Periodic component (solid line) is above the zero level and colored green, the primary underlying cycle is in an upward phase. Conversely, a red line below zero indicates a downward phase.
Cycle Crosses: Traders can look for the Short-Term Periodic component (dotted line) crossing the Long-Term component or the zero line to anticipate shorter-term shifts in momentum.
Normalization: When the "Normalize" setting is enabled, the components are scaled relative to their combined absolute magnitude. This is particularly useful for identifying extreme cycle peaks regardless of absolute price volatility.
🔶 DETAILS
Singular Spectrum Analysis (SSA) is a powerful non-parametric technique used in time-series analysis. This indicator implements a rolling version of SSA through the following mathematical steps:
Embedding: The price data is mapped into a trajectory matrix using the "Window" length defined in the settings.
Decomposition: A covariance matrix is computed, followed by eigendecomposition to find the eigenvalues and eigenvectors.
Grouping & Reconstruction: The eigenvectors are sorted by their energy (eigenvalues). The script specifically reconstructs the first two components to form the Long-Term trend/cycle and the subsequent two components to form the Short-Term cycle.
Because this script uses matrix.eigenvalues() and matrix.eigenvectors() , it requires significant computation. The "Window" input determines the "resolution" of the cycles; a larger window can capture longer-term rhythms but increases the lag and computational load.
🔶 SETTINGS
Window: Controls the embedding dimension (L). This defines the maximum cycle length the indicator can effectively resolve.
Long Term Periodic: Toggles the visibility of the primary trend-following cycle (Components 1 & 2).
Short Term Periodic: Toggles the visibility of the faster, more reactive cycle (Components 3 & 4).
Normalize: If enabled, adjusts the output so that the combined amplitude of both components stays within a consistent range, making it easier to spot cyclical extremes.
🔹 Dashboard
Dashboard: Toggles the on-screen statistics table.
Position: Determines where the dashboard is displayed (Top Right, Bottom Right, or Bottom Left).
Size: Adjusts the text size within the dashboard.
Indicateur Pine Script®






















