Loading…

Goertzel Cycle Finder

A full spectrum answers "what frequencies are present at all"; this asks a narrower, cheaper question - "how strong is EACH SPECIFIC period in my chosen range" - and answers it directly. The Goertzel algorithm evaluates one candidate period in O(N) work using a short recursive filter, so testing every integer period between InpMinPeriod and InpMaxPeriod costs only a targeted scan across that range, not a full transform's worth of bins that then need filtering down to the interesting ones. The analysed window is linearly detrended first, for the same reason a full spectrum is: without it, the underlying trend would dominate every period test and mask genuine cyclical structure. Each candidate period's Goertzel recursion yields real and imaginary components directly, from which amplitude (in price units) and phase (referenced to the start of the analysis window) fall out with no extra pass over the data. The panel ranks the InpTopCount strongest periods by that power and lists all three figures for each - enough to judge not just which periods matter but how big their swing currently is and where in their cycle the market currently sits. Notes and limitations - Needs InpWindowBars plus one bar of history before the panel can fill. - Nearby periods (for example 19 and 20 bars) that both partially match the same real cycle are not merged or de-duplicated; they may both appear in the ranked list as if they were separate cycles. - Amplitude and power describe how strongly a period matched the ANALYSED WINDOW, not a forecast that it will keep matching. - Recomputed once per closed bar, so nothing here can repaint a bar that has already closed.

Indicator · MT4 · v1.0 · Free

About Goertzel Cycle Finder

Goertzel Cycle Finder is an indicator for MetaTrader 4. It has 5 settings, such as Window bars, Min period and Max period. MQL source code included.

Files in the download: GoertzelCycleFinder.ex4, GoertzelCycleFinder.mq4, GoertzelCycleFinder.txt.

Settings

SettingDefaultWhat it does
Window bars200Samples analysed per scan
Min period5Shortest period tested, in bars
Max period60Longest period tested, in bars
Top count3Number of ranked cycles shown
Corner1Panel corner: 0=LU 1=RU 2=LL 3=RL

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria