Skip to main content

Fourier Transform vs Goertzel Algorithm for Trading

FFT gives you everything. Goertzel gives you what you need. Choosing the right spectral method depends on your specific application.

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

Both the Fast Fourier Transform (FFT) and the Goertzel algorithm decompose signals into frequency components. For trading applications, the choice between them has practical implications for speed, flexibility, and ease of implementation.

FFT Overview

The FFT computes the Discrete Fourier Transform efficiently, producing power estimates for all frequencies simultaneously. Given N data points, you get N/2 frequency bins in one computation.

Advantages:

  • Complete spectrum in one pass
  • Highly optimized implementations available
  • Good for exploratory analysis

Disadvantages:

  • Best efficiency requires power-of-2 sample sizes
  • Computes many frequencies you do not need
  • Frequency resolution tied to sample length

Goertzel Overview

Goertzel computes power at specific target frequencies individually. It is mathematically equivalent to computing a single bin of the DFT.

Advantages:

  • Efficient when you need only specific frequencies
  • Works with any sample size
  • Numerically stable
  • Easy to implement

Disadvantages:

  • Must specify which frequencies to calculate
  • Slower than FFT if you need many frequencies
  • Does not give full spectrum view

Computational Comparison

The crossover point depends on how many frequencies you need:

  • Few frequencies (1-10): Goertzel is faster
  • Many frequencies (50+): FFT is faster
  • Intermediate: Depends on implementation and sample size

For trading cycle detection, you typically scan 20-50 frequencies (e.g., periods from 10 to 100 bars). In this range, the difference is often negligible on modern hardware. Choose based on convenience.

When FFT Is Better

Use FFT when:

  • You want to see the complete frequency spectrum
  • You are exploring data without preconceptions about which cycles exist
  • Sample size is conveniently a power of 2
  • You are analyzing many instruments and need batch efficiency

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 Now

When Goertzel Is Better

Use Goertzel when:

  • You know which frequency range to scan
  • You need non-power-of-2 frequency resolution
  • You are implementing from scratch (simpler algorithm)
  • You want to compute specific periods like 20, 40, 60 bars exactly

Practical Recommendation

For trading applications, Goertzel often makes more sense:

  1. You typically know the cycle range of interest (e.g., 10-200 bars)
  2. You want specific periods, not arbitrary frequency bins
  3. Sample sizes in trading data are rarely convenient powers of 2
  4. Implementation is simpler and less error-prone

At FractalCycles, we use Goertzel for production cycle detection. It gives us exactly the frequencies we care about without the overhead of computing the full spectrum.

Hybrid Approach

Some systems use both:

  1. FFT for initial exploration: scan the full spectrum to identify interesting regions
  2. Goertzel for focused analysis: compute precise power at specific target periods
  3. FFT for visualization: show users the complete power spectrum
  4. Goertzel for trading logic: efficient calculation of key cycles

This leverages the strengths of each method.

Implementation Notes

If implementing yourself:

  • FFT: Use a library (NumPy, FFTW). Do not write your own FFT.
  • Goertzel: Simple enough to implement correctly. About 10 lines of code.

Both methods benefit from detrending the data first. Apply to log returns or detrended prices, not raw price levels.

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.