INVITE-ONLY SCRIPT
Cycle Spectrum Analyzer

Cycle Spectrum Indicator — Short Description
This indicator computes a visual Fourier cycle spectrum from the input price data to reveal the market’s dominant cyclical behaviour. The price series is first detrended using a Hodrick–Prescott filter, after which a specialized Fourier analysis variant extracts the cycle components.
The resulting spectrum displays peaks that represent the dominant cycles present in the data, where each peak’s cycle length and amplitude indicate the strength and duration of the underlying rhythm. The most significant peaks are ranked, highlighting the top cycles currently driving market movement. Each detected cycle also includes a phase value, describing the cycle’s position at the most recent bar (e.g., topping, bottoming, rising, falling).
The indicator can be used to:
Additional Explanation of the included visual example image
Left Area – The Theoretical “Perfect Cycle”
The left part of the illustration presents a theoretical, perfectly smooth sine-wave cycle. This serves as a reference model to explain the core cycle parameters:
Right Area – The Price Series Used for Analysis
On the right, the actual price chart (e.g., Dow Jones Industrial Average) is displayed. This is the dataset from which the Fourier cycle spectrum is computed.
At the bottom of this chart section, a purple bar indicates the amount of historical data included in the cycle analysis. Because Fourier-based methods depend strongly on sample size, this visual cue shows how far back the indicator collected and processed data before generating the spectrum.
Bottom Area – The Cycle Spectrum Output Pane
The lower pane contains the Cycle Spectrum Analyzer output:
Calculation Only at the Last Bar
The indicator performs its full Fourier-based cycle decomposition exclusively on the most recent bar. This ensures that the spectrum always reflects the current market state without repeatedly recalculating historical spectra. The result is an efficient, real-time snapshot of the dominant cycles influencing the price at the latest point in time.
Works on Any Symbol and Any Timeframe
Because the analysis operates directly on the provided price series, the indicator is compatible with all markets and all timeframes—stocks, indices, forex, crypto, futures, and intraday charts alike.
The detected cycle lengths always refer to the selected chart’s bar interval (e.g., 240-bar cycle on a 1h chart ≈ 240 hours; same cycle on a daily chart ≈ 240 days).
Adjustable Historical Lookback (Default: 1100 Bars)
The accuracy of cycle detection depends on the amount of historical data used. The indicator provides a parameter allowing you to specify how many past bars should be included in the Fourier calculation.
This indicator computes a visual Fourier cycle spectrum from the input price data to reveal the market’s dominant cyclical behaviour. The price series is first detrended using a Hodrick–Prescott filter, after which a specialized Fourier analysis variant extracts the cycle components.
The resulting spectrum displays peaks that represent the dominant cycles present in the data, where each peak’s cycle length and amplitude indicate the strength and duration of the underlying rhythm. The most significant peaks are ranked, highlighting the top cycles currently driving market movement. Each detected cycle also includes a phase value, describing the cycle’s position at the most recent bar (e.g., topping, bottoming, rising, falling).
The indicator can be used to:
- Identify the top 3 dominant cycles with their length and phase.
- Analyze the current market state by interpreting these phases.
- Feed the dominant cycle lengths—often half the primary cycle—into other technical indicators for improved parameter tuning.
- Project cycles forward to estimate upcoming turning points and anticipate potential trend shifts.
Additional Explanation of the included visual example image
Left Area – The Theoretical “Perfect Cycle”
The left part of the illustration presents a theoretical, perfectly smooth sine-wave cycle. This serves as a reference model to explain the core cycle parameters:
- Cycle Length – The full wavelength of one complete oscillation (from trough to trough or peak to peak).
- Phase – The current position within that cycle, expressed both numerically and as an easy-to-read text label such as Bottom_Departure, Uptrend_Neutral, Approaching Top, or Top_Departure.
Right Area – The Price Series Used for Analysis
On the right, the actual price chart (e.g., Dow Jones Industrial Average) is displayed. This is the dataset from which the Fourier cycle spectrum is computed.
At the bottom of this chart section, a purple bar indicates the amount of historical data included in the cycle analysis. Because Fourier-based methods depend strongly on sample size, this visual cue shows how far back the indicator collected and processed data before generating the spectrum.
Bottom Area – The Cycle Spectrum Output Pane
The lower pane contains the Cycle Spectrum Analyzer output:
- It displays the cycle spectrum at the most recent bar, where each green peak corresponds to a detected cycle.
- Peak height = amplitude (strength) of the cycle
- Peak position (horizontal) = dominant cycle length
- The largest peaks represent the strongest cycles currently present in the detrended price series.
- Rank (1 = strongest)
- Cycle Length (in bars)
- Phase Description (interpreting where that cycle is right now)
- Which cycles are strongest,
- How long they are,
- And whether they are currently bottoming, topping, rising, or falling.
Calculation Only at the Last Bar
The indicator performs its full Fourier-based cycle decomposition exclusively on the most recent bar. This ensures that the spectrum always reflects the current market state without repeatedly recalculating historical spectra. The result is an efficient, real-time snapshot of the dominant cycles influencing the price at the latest point in time.
Works on Any Symbol and Any Timeframe
Because the analysis operates directly on the provided price series, the indicator is compatible with all markets and all timeframes—stocks, indices, forex, crypto, futures, and intraday charts alike.
The detected cycle lengths always refer to the selected chart’s bar interval (e.g., 240-bar cycle on a 1h chart ≈ 240 hours; same cycle on a daily chart ≈ 240 days).
Adjustable Historical Lookback (Default: 1100 Bars)
The accuracy of cycle detection depends on the amount of historical data used. The indicator provides a parameter allowing you to specify how many past bars should be included in the Fourier calculation.
- Standard value: 1100 bars
- Increasing the lookback allows detection of longer cycles, but may dilute short-term characteristics.
- Decreasing it focuses on shorter and medium-term cycles, increasing responsiveness but reducing visibility of long-duration rhythms.
仅限邀请脚本
只有作者授权的用户才能访问此脚本。您需要申请并获得使用许可。通常情况下,付款后即可获得许可。更多详情,请按照下方作者的说明操作,或直接联系StockMarketCycles。
TradingView不建议您付费购买或使用任何脚本,除非您完全信任其作者并了解其工作原理。您也可以在我们的社区脚本找到免费的开源替代方案。
作者的说明
Access to this indicator is available to readers who are, or who choose to become, professional subscribers to my private blog:
https://stockmarketcycles.substack.com/subscribe
Lars von Thienen
Join my blog and never miss an update:
stockmarketcycles.substack.com/subscribe
Join my blog and never miss an update:
stockmarketcycles.substack.com/subscribe
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
仅限邀请脚本
只有作者授权的用户才能访问此脚本。您需要申请并获得使用许可。通常情况下,付款后即可获得许可。更多详情,请按照下方作者的说明操作,或直接联系StockMarketCycles。
TradingView不建议您付费购买或使用任何脚本,除非您完全信任其作者并了解其工作原理。您也可以在我们的社区脚本找到免费的开源替代方案。
作者的说明
Access to this indicator is available to readers who are, or who choose to become, professional subscribers to my private blog:
https://stockmarketcycles.substack.com/subscribe
Lars von Thienen
Join my blog and never miss an update:
stockmarketcycles.substack.com/subscribe
Join my blog and never miss an update:
stockmarketcycles.substack.com/subscribe
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。