Fourier Spectrum Panel
Price is rarely a clean sum of sine waves, but it usually has SOME periodic structure buried in the noise - a cycle length that recurs more often than chance would suggest. This computes a Discrete Fourier Transform of the last N closes (a direct O(N^2) transform, not an FFT - at the few hundred samples this needs, that is fast enough, and it avoids the power-of-two window-size restriction an FFT would otherwise impose) and plots the power at every frequency bin as a histogram. The window is linearly detrended before transforming. Without that step, the dominant trend in price would concentrate almost all the power in the lowest-frequency bin and bury every genuine cycle underneath it - removing the trend first is what lets shorter, real periodicities show up at all. Because a spectrum's natural axis is frequency, not calendar time, the histogram's bar-by-bar position on the chart represents bin index rather than a date. Only the rightmost half of the analysed window carries data for this reason; the rest of the subwindow is intentionally left empty rather than stretched to fill the chart, which would misrepresent what the x-axis means. The single strongest bin is marked with a dot, and its equivalent period in bars is written into the indicator's short name so it is visible without needing to read bin positions off the histogram by eye. Notes and limitations - Needs InpWindowBars plus one bar of history before the first spectrum can be drawn. - The x-axis position within the histogram is a frequency bin index, not chart time - only the rightmost InpWindowBars/2 bars carry a value. - A direct DFT assumes the analysed window is representative of the market's current behaviour; a regime change partway through the window blurs the spectrum rather than cleanly showing "before" and "after". - This identifies periodicity that existed IN THE ANALYSED WINDOW. It is a descriptive read of recent structure, not a forecast that the same cycle will continue. - Recomputed once per closed bar rather than every tick, so nothing here can repaint a bar that has already closed.
Indicator · MT4 · v1.0 · Free
About Fourier Spectrum Panel
Fourier Spectrum Panel is an indicator for MetaTrader 4. It draws buy and sell arrows on the chart. It has 1 setting, such as Window bars. MQL source code included.
Files in the download: FourierSpectrumPanel.ex4, FourierSpectrumPanel.mq4, FourierSpectrumPanel.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Window bars | 128 | Samples analysed per spectrum (even number) |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Buy/Sell Arrows · MT4 Indicator · MQL4 Source Code