Opens in a new tab
Fourier Extrapolator Indicator MT4

Fourier Extrapolator Indicator MT4

The Fourier Extrapolator is a chart-window MT4 indicator that hunts through recent price history for a dominant cycle and projects it forward as a forecast curve. It's a free, instant download, and because it's doing real signal-processing math under the hood rather than a simple moving average, it's worth understanding exactly what it's plotting before…

Download the Fourier Extrapolator Indicator MT4

The Fourier Extrapolator is a chart-window MT4 indicator that hunts through recent price history for a dominant cycle and projects it forward as a forecast curve. It’s a free, instant download, and because it’s doing real signal-processing math under the hood rather than a simple moving average, it’s worth understanding exactly what it’s plotting before you put any weight on it.

What It Actually Calculates

On the first tick after it’s attached, the indicator runs a loop that shrinks a test window from your input T down to a fixed floor of 20 bars, one bar at a time. For every window size it does two things:

  • Runs af_LR(), a least-squares linear regression on Close[] over the window, producing a slope (aa) and intercept (bb) that de-trend the data.
  • Runs af_FT(), a discrete Fourier transform on the de-trended closes, computing cosine/sine coefficients (ak[], bk[]) for the first six harmonics and their power spectrum.

The code specifically watches harmonic #3. Whenever that harmonic holds the highest power in the spectrum, it stores the window’s coefficients; the moment a different harmonic takes over, it locks in whichever stored window scored highest and reconstructs a cosine/sine wave from those coefficients plus the linear trend. That reconstructed curve, extended forward, is the orange line you see (the prognoz[] buffer, drawn with DRAW_LINE at width 3).

A second, thinner blue line (the profit[] buffer) is a simple simulated equity curve: it walks backward from the current bar and adds or subtracts Open-Close depending on whether the forecast curve was sloping up or down at each step. It’s illustrative only, not a real strategy backtest.

How to Read the Chart

The orange curve is the fitted-and-extrapolated dominant cycle. Rising segments represent the projected bullish half of the cycle; falling segments represent the projected bearish half. When shift is greater than zero and showprofit is enabled, you’ll also see a vertical dashed orange time-line and a horizontal blue price-line marking the reference bar the whole projection is anchored to.

Inputs

  • T (default 1000) — the starting window length, in bars, that the cycle search begins shrinking from.
  • shift (default 0) — the bar index used as the anchor point for the projection; 0 means the analysis is anchored to the current bar.
  • showprofit (default true) — toggles the blue simulated equity line and the reference price/time lines; automatically disabled if shift is 0.
  • alert (default false) — pops an Alert() box when a new dominant cycle window is locked in during the search.

Why It Locks Onto One Specific Harmonic

Even though af_FT() computes six harmonics (k = 1 through 6) for every window size, the search loop only ever checks whether harmonic index 3 holds the maximum power in a four-element spectrum array covering indices 2 through 5. In other words, the indicator is deliberately narrow: it isn’t asking “what’s the strongest cycle in this data” across all possible frequencies, it’s asking “does the third harmonic dominate this particular window,” and only stores a candidate result when that specific condition is true. That’s also the likely source of the “4th cycle” in the indicator’s original file name — the code is fixed on one harmonic slot, not a general-purpose cycle finder that adapts to whichever frequency happens to be strongest.

Repaint Behavior — Read This Before Trading

This is the part that matters most. The entire calculation block only runs when an internal static counter (bars) is still at zero — in practice, that means it runs its full cycle search exactly once per attachment, then freezes. It will not recompute on subsequent ticks unless you remove and reapply it, reload the chart, or switch timeframes. But every time that fresh calculation does run, it rebuilds the whole forecast line — including the portion overlaying bars that were already printed and visible before — using the price data available at that moment. That means the same historical bars can show a visibly different orange curve the next time you reattach the indicator, because the linear regression and Fourier fit are recalculated over a shifted window of closes. Functionally, that’s repainting: the historical segment of the curve is not a fixed, tick-stable signal you can backtest against.

Limitations

  • It freezes after the first calculation — it will not update its forecast in real time as new bars form unless you reload it.
  • Running a Fourier transform at every window size from T down to 20 is computationally heavy; expect a noticeable pause on attach with large T values or deep history.
  • It’s a curve-fitting and extrapolation tool, not a complete trading system — there’s no built-in entry/exit logic, and the blue profit line is not a validated backtest.
  • Because it only recalculates once, the alert for a newly detected cycle will typically only fire at the moment of attachment, not continuously.
Download the Fourier Extrapolator Indicator MT4
  • T (default 1000) — Starting length (in bars) of the search window that shrinks down to 20 bars while looking for the strongest dominant cycle.
  • shift (default 0) — Bar index used as the anchor point for the cycle projection; 0 anchors the analysis to the current bar.
  • showprofit (default true) — Displays the blue simulated equity line plus reference price/time markers; disabled automatically if shift is 0.
  • alert (default false) — Shows a popup Alert() when a new dominant cycle window is locked in during the search.

FAQs About the MT4 Fourier Extrapolator Indicator MT4

One Quick Step

Enter your name and email and check your inbox for the download link.