OPEN-SOURCE SCRIPT

Cycle Spectrogram [LuxAlgo]

1 156
The Cycle Spectrogram indicator is a spectral analysis tool that visualizes the power of various price cycles to identify dominant periodicities and market rhythms.

🔶 USAGE

The indicator provides a technical visualization of spectral density over time by decomposing price action into multiple cycle bands. This allows traders to identify whether the market is currently influenced by short-term noise or long-term structural cycles.

🔹 Spectrogram Interpretation

The spectrogram consists of 30 rows, each representing a specific cycle period. The vertical axis is logarithmically scaled between the "Minimum Period" and "Maximum Period" settings.

  • Color Intensity: Brighter or more saturated colors (depending on the selected theme) indicate higher spectral power or "energy" at that specific cycle length.
  • Vertical Position: Higher rows represent longer cycle periods (slower cycles), while lower rows represent shorter periods (faster cycles).


🔹 Dominant Period Tracking

To help identify the most significant cycle at any given time, the script includes a Dominant Period Marker (red cross). This marker tracks the row with the highest energy, providing a real-time estimate of the current market cycle length in bars.

🔹 Dashboard Metrics

A real-time dashboard provides key analytical data:

  • Current DP: The period (in bars) of the most powerful cycle found in the current bar.
  • Average DP: A 20-period moving average of the dominant period, useful for identifying stable, persistent cycles versus erratic shifts.
  • Lowest Period: A reference for the minimum boundary of the spectral analysis.


🔶 DETAILS

A spectrogram is a visual representation of the spectrum of a signal as it varies with time. This script utilizes a series of Bandpass filters to isolate specific cycle lengths. Each filter is tuned to a period calculated using a logarithmic distribution, ensuring that the analysis covers a wide range of market periodicities without bias toward specific scales.

The "Power" of each cycle is calculated by squaring the output of the bandpass filter and applying a smoothing factor. This process helps filter out transient spikes and provides a cleaner "heat" signature for more reliable cycle identification.

🔶 SETTINGS

🔹 Aesthetics

  • Theme: Select from several high-contrast color maps, including Viridis, Inferno, Magma, Plasma, Cividis, and Turbo.


🔹 Settings

  • Minimum Period: The shortest cycle length (in bars) to include in the analysis.
  • Maximum Period: The longest cycle length (in bars) to include in the analysis.
  • Bandwidth: Controls the "focus" or resonance of each cycle band. Lower values result in narrower, more precise detection, while higher values allow for more overlap.
  • Power Smoothing: Determines the amount of smoothing applied to the amplitude. Higher values reduce visual noise but may increase lag in detecting cycle shifts.


🔹 Dashboard

  • Dashboard: Toggles the visibility of the data table.
  • Position: Moves the dashboard to different corners of the pane.
  • Size: Adjusts the text and cell size of the dashboard.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.