Skip to main content

Spectral Analysis for Non-Stationary Markets

Adapting frequency analysis to the reality of evolving market behavior.

About this content: This page describes observable market structure through the Fractal Cycles framework. It does not provide forecasts, recommendations, or trading instructions.

Classical spectral analysis assumes the signal being analyzed is stationary — its statistical properties do not change over time. This assumption fails for financial markets, where dominant cycles shift, volatility regimes evolve, and the underlying structure itself is in constant flux. Understanding how to adapt frequency analysis tools to this reality is essential for extracting reliable cycle information. Our guide on detrending methods addresses one aspect of this challenge, but non-stationarity requires a broader set of adaptations.

The Stationarity Problem

Markets evolve. Dominant cycles shift. A 40-bar cycle strong in one period may weaken or disappear entirely in the next. Volatility regimes change. New participants enter; old ones exit. The data-generating process itself is non-stationary.

This creates a genuine methodological challenge: how do we apply frequency analysis tools designed for stationary signals to inherently non-stationary data? The Goertzel algorithm and FFT both assume that the frequencies present at the beginning of the analysis window are the same frequencies present at the end. When this assumption is violated, spectral estimates become blurred — power spreads across adjacent frequencies, peaks broaden, and the resulting spectrum may not accurately represent any single moment in time.

The degree to which non-stationarity affects results depends on how rapidly the underlying structure changes relative to the analysis window length. A slowly evolving cycle structure analyzed in a moderate window produces reasonably accurate results. A rapidly shifting structure in a long window produces a smeared average that may not reflect current conditions.

Practical Adaptations

Several techniques help address non-stationarity, each with trade-offs:

Windowed analysis: Rather than analyzing entire price history, focus on a rolling window of recent data. A 500-bar window captures current cycle structure without being contaminated by ancient patterns that may no longer apply. The window length is itself an analytical choice — shorter windows emphasize recency but reduce statistical power.

Detrending: Removing trend before spectral analysis reduces one source of non-stationarity. The detrended series, while not fully stationary, is closer to the assumptions underlying frequency analysis. Different detrending methods remove different types of trend, and the choice affects which cycles become visible.

Validation testing: The Bartels significance test does not assume stationarity in the same way raw spectral analysis does. It tests whether observed periodicity exceeds random expectation — a more robust question that partially compensates for non-stationary conditions.

Periodic re-analysis: Treat cycle detection as a recurring process, not a one-time calculation. Run fresh analysis as new data arrives. Cycles that persist across multiple analyses are more trustworthy than those appearing once.

Windowing Techniques

The choice of analysis window deserves careful consideration. Window design involves two related decisions: the window length and the window shape.

Window length determines the trade-off between recency and reliability. Short windows (100-200 bars) respond quickly to structural changes but may lack sufficient data to reliably detect longer cycles. Long windows (500-1000 bars) provide stable estimates but may include obsolete structure. As a guideline, the window should contain at least 3-5 complete repetitions of the longest cycle you wish to detect. For a 100-bar cycle, this means a minimum window of 300-500 bars.

Window shape refers to how data within the window is weighted. A rectangular window weights all data equally. A tapered window (such as Hann or Hamming) reduces the weight of data at the edges, which reduces spectral leakage — the spreading of power across adjacent frequencies that occurs when the signal is abruptly cut off at the window boundaries.

  • Rectangular window: Simple but produces spectral leakage. Good for quick analysis where precision is less critical.
  • Hann window: Reduces leakage significantly with moderate loss of frequency resolution. A good general-purpose choice.
  • Exponential weighting: Places more weight on recent data, explicitly addressing the recency preference. More recent data contributes more to the spectral estimate, naturally adapting to evolving structure.

Adaptive Spectral Methods

Beyond fixed-window approaches, several adaptive methods have been developed specifically for non-stationary signals:

Short-Time Fourier Transform (STFT): Applies the FFT to successive overlapping windows, producing a time-frequency representation. This shows how the spectral content evolves over time. While computationally more expensive than a single FFT, the STFT reveals when cycles appear and disappear — information that a single spectral analysis cannot provide.

Evolutionary spectrum analysis: A family of methods that explicitly model the spectrum as time-varying. These methods estimate how spectral power at each frequency changes over time, producing a dynamic picture of cycle structure. They are particularly useful for understanding structural transitions.

Multiple window comparison: A practical approach that involves running the same spectral analysis at multiple window lengths (for example, 200, 400, and 600 bars) and comparing the results. Cycles that appear consistently across all window lengths are more likely to represent genuine, stable structure. Cycles that appear only in certain windows may be transient or artifacts of the window boundary.

What Non-Stationarity Means for Results

Accept that spectral results are snapshots, not permanent truths. A power spectrum computed today reflects the cyclical structure of the data window analyzed. That structure may differ from last month's structure or next month's structure.

This is not a flaw — it is reality. Markets change; our analysis should reflect current conditions, not historical averages. The goal is understanding present structure, not discovering eternal laws. The Hurst exponent provides complementary information about regime character that helps contextualize spectral results — it tells you whether the overall market environment is favorable for cyclical analysis.

Regime-Aware Spectral Analysis

One of the most effective approaches to non-stationarity is to condition spectral analysis on the current market regime. The Hurst exponent divides market behavior into broad categories, and spectral analysis can be interpreted differently within each:

Mean-reverting regime (H < 0.45): Spectral analysis is most reliable here. The oscillatory nature of mean-reverting markets aligns well with the assumptions of frequency analysis. Detected cycles tend to be more stable and more likely to persist forward.

Trending regime (H > 0.55): Spectral analysis is less reliable because the trend component may not be fully removed by detrending, and the persistent nature of price movements can create spurious low-frequency peaks. In these conditions, cycles detected at higher frequencies (shorter periods) are generally more trustworthy than those at lower frequencies. The underlying trend should be considered the dominant structural feature, with cycles as secondary.

Transitional regime (H near 0.5): Spectral results during transitions may be unstable as the market shifts between regimes. This is when periodic re-analysis is most important — the cycle structure may be actively changing.

Detect hidden cycles in any market

See which cycle periods are statistically significant in any market data — run a free analysis with our robust cycle detection software.

Try it free

Signs of Cycle Instability

Watch for these indicators that cycles may be shifting:

  • Declining Bartels scores: A cycle that scored 75% last month but 55% this month may be weakening. Track Bartels scores over successive analyses to identify trends.
  • Period drift: A "40-bar cycle" that was 38 bars last quarter and 43 bars this quarter is not stable. True cycles exhibit moderate period drift (±5-10%); larger drift suggests the cycle is not well-defined.
  • Amplitude changes: Cycles can maintain period while losing (or gaining) strength. Declining amplitude may precede cycle disappearance.
  • Spectral peak broadening: A narrow, sharp spectral peak indicates a well-defined cycle. A broad, diffuse peak suggests the frequency is not stable — the cycle is wobbling in period length.
  • Regime breaks: Major market events can reset cyclical structure entirely. After such events, allow fresh data to accumulate before relying on cycle analysis.

Practical Workflow for Non-Stationary Markets

Given the challenges of non-stationarity, we recommend a structured workflow that balances rigor with practicality:

  1. Run spectral analysis on a moderate window (400-600 bars for daily data) using appropriate detrending. Record the detected cycles, their periods, amplitudes, and Bartels scores.
  2. Verify with a shorter window (200-300 bars). Compare results. Cycles present in both windows are more trustworthy.
  3. Check regime context using the Hurst exponent. Interpret spectral results in light of whether the market is trending, mean-reverting, or transitional.
  4. Track over time. Maintain a log of detected cycles across successive analyses. Cycles that appear consistently over weeks or months are genuine structural features. Those that appear once and vanish are likely transient.
  5. Update regularly. Re-run the analysis weekly (for daily data) or daily (for intraday data). Fresh analysis captures evolving structure and prevents reliance on stale cycle information.

Working With Uncertainty

Non-stationarity means cycle analysis carries inherent uncertainty. This is uncomfortable but honest. We prefer methods that acknowledge uncertainty over methods that hide it behind false precision.

The practical response: treat cycle analysis as orientation rather than prediction, validate detected cycles with the statistical significance framework, re-run analysis regularly, and maintain appropriate humility about the stability of any finding. The cycle period finder tool facilitates this iterative approach by making re-analysis quick and straightforward.

Markets are not periodic signals with fixed frequencies. They are complex adaptive systems with cyclical tendencies that evolve. Our analysis must respect this reality — extracting what structure exists while acknowledging that the structure itself is always changing.

Framework: This analysis uses the Fractal Cycles Framework, which identifies market structure through spectral analysis rather than narrative explanation.

KN

Written by Ken Nobak

Market analyst specializing in fractal cycle structure

Disclaimer

This content is for educational purposes only and does not constitute financial, investment, or trading advice. Past performance does not guarantee future results. The analysis presented describes observable market structure and should not be interpreted as predictions, recommendations, or signals. Always conduct your own research and consult with qualified professionals before making trading decisions.

See cycles in your own data

Apply the Fractal Cycles framework to any market using our analysis tools. Start with a free account.