Skip to main content

Goertzel Algorithm vs MESA: Spectral Analysis Methods Compared

Two leading approaches to detecting market cycles from price data, each with distinct strengths and trade-offs.

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

The Goertzel algorithm and MESA (Maximum Entropy Spectral Analysis) are both methods for detecting cycles in market data, but they approach the problem from fundamentally different mathematical perspectives. Understanding their differences helps analysts choose the right tool for their specific needs.

Core Methodology

Goertzel Algorithm

The Goertzel algorithm computes the Discrete Fourier Transform at specific target frequencies. Given a time series and a set of periods to evaluate (e.g., every integer period from 8 to 200 bars), Goertzel computes the spectral power at each target frequency independently.

Mathematically, Goertzel is equivalent to computing individual bins of the DFT. It uses a second-order recursive filter that accumulates energy at the target frequency across the entire input signal. The result is exact spectral power—no estimation or approximation involved.

MESA (Maximum Entropy Spectral Analysis)

MESA, popularized in trading by John Ehlers, takes a fundamentally different approach. Instead of computing the Fourier transform, it models the data as an autoregressive process and derives the spectral density from the model coefficients.

The "maximum entropy" principle means the method makes minimal assumptions about frequencies not present in the data. It extrapolates the autocorrelation sequence to produce a smooth spectral estimate with potentially sharper peaks than FFT-based methods.

Frequency Resolution

Goertzel has the same frequency resolution as the standard DFT: resolution is determined by data length. To distinguish a 40-bar cycle from a 42-bar cycle, you need sufficient data (roughly 400+ bars). The resolution is fixed and well-understood—there are no surprises.

MESA can produce apparent super-resolution—seemingly distinguishing closely-spaced frequencies from shorter data windows than the DFT would require. This is both its strength and its risk. The enhanced resolution comes from the autoregressive model assumptions, and when those assumptions hold (smooth spectral shape, few dominant frequencies), the results are excellent. When they do not hold, MESA can produce spurious peaks.

Adaptivity

Goertzel in its basic form analyzes a fixed data window and produces a static spectrum. To track how cycles change over time, you must run Goertzel repeatedly on sliding windows (which FractalCycles supports). This gives you explicit control over the analysis window but requires choosing a window length.

MESA was specifically designed for adaptive cycle tracking. Ehlers' implementations typically use a short analysis window (often just 40-60 bars) and update the spectral estimate with each new bar. This makes MESA inherently suited to tracking cycles that shift in period over time—a common characteristic of market data.

This adaptivity is MESA's primary selling point for trading applications. Markets are non-stationary; cycles do shift. An approach that can track these shifts in near real-time has practical advantages.

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

Statistical Reliability

Goertzel produces spectral power values that are directly comparable across frequencies and can be tested for statistical significance using methods like the Bartels test. The mathematical relationship between Goertzel output and the underlying signal is well-characterized, making it straightforward to assess whether a detected peak is genuine.

MESA spectral estimates are more difficult to validate statistically. The maximum entropy assumption can create sharp peaks from limited data, and distinguishing genuine peaks from model artifacts requires expertise. There is no standard equivalent of the Bartels test for MESA-derived spectra. This makes MESA more prone to false positives—reporting cycles that are not genuinely present.

Data Requirements

Goertzel works best with longer data histories. For reliable detection of a 50-bar cycle, you want at least 400-500 bars (8-10 full cycles). The algorithm is exact, so the main limitation is the fundamental resolution limit of the DFT.

MESA explicitly targets shorter data windows. The autoregressive model allows meaningful spectral estimates from as few as 40-60 bars. This makes MESA attractive for situations where long histories are unavailable or where only recent data is relevant (e.g., a newly listed security or a market undergoing structural change).

Computational Characteristics

Goertzel is computationally simple and efficient. For N target frequencies on M data points, the complexity is O(N × M). It has no iteration, no convergence criteria, and no tuning parameters beyond the target frequency range.

MESA requires solving the autoregressive model, typically using the Burg algorithm. The model order (how many AR coefficients to fit) is a critical parameter: too low and you miss cycles; too high and you overfit noise. Selecting the right model order requires either expertise or automated selection criteria, adding complexity to the pipeline.

Practical Comparison

DimensionGoertzelMESA
Best forComprehensive cycle survey with statistical validationAdaptive tracking of shifting dominant cycle
Data needed400+ bars for reliable results40-60 bars minimum
False positive riskLow (with Bartels validation)Higher (model-dependent peaks)
AdaptivityVia sliding window (manual)Built-in, bar-by-bar
Statistical testingBartels test built-inNo standard validation method
Tuning parametersFrequency range onlyModel order (critical choice)
InterpretabilityDirect spectral power (intuitive)Model-derived estimate (less intuitive)

When to Use Which

Use Goertzel when:

  • You have sufficient data history (400+ bars)
  • Statistical validation of detected cycles is important
  • You want to survey the full spectrum for all significant cycles
  • You are building composite projections from multiple validated cycles
  • Reproducibility and objectivity are priorities

Use MESA when:

  • You need to track a shifting dominant cycle in near real-time
  • Limited data history is available
  • You are primarily interested in the single dominant cycle, not the full spectrum
  • You have experience selecting appropriate AR model orders
  • Adaptivity to changing market conditions is the primary requirement

The approaches can also be complementary. Use Goertzel with a longer history to identify and validate the major cycles, then use MESA to track how the dominant cycle period shifts in real-time. FractalCycles uses the Goertzel-plus-Bartels approach because statistical validation is central to its methodology—but understanding both methods deepens your analytical toolkit.

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.