OPEN-SOURCE SCRIPT
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
🔶 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:
Because this script usesPine Script® and Pine Script® , 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
🔹 Dashboard
🔶 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()
matrix.eigenvectors()
🔶 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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Build your own edge with AI: luxalgo.com
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Build your own edge with AI: luxalgo.com
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.