Loading…

Dominant Cycle Period Meter

Most oscillators and moving averages ask the trader to pick a period up front and leave it fixed, even though the market's own rhythm drifts over time. This measures that rhythm directly, by autocorrelation: the detrended price window is compared against a copy of itself shifted by every candidate lag between InpMinPeriod and InpMaxPeriod, and whichever lag correlates most strongly with the unshifted window is reported as the current dominant period - literally, the length the market currently looks most self-similar to. The result is plotted as an ordinary indicator line, computed once per closed bar over that bar's own trailing window and never revisited, so the whole history is a genuine causal record of what the estimate was at each point in time rather than a single live number with no memory. That history is what makes the line useful on its own terms - a period readout that visibly jumped last week explains why an indicator tuned to last month's rhythm has been behaving oddly since. An optional alert fires once per bar when the estimate moves by more than a configurable number of bars from one close to the next, flagging a regime change in the market's rhythm rather than a routine wobble. Notes and limitations - Needs InpWindowBars plus one bar of history before the first estimate appears. - Autocorrelation reports the STRONGEST self-similar lag in range, not necessarily the only one - a market with two overlapping cycles will show whichever currently correlates harder, and can flip between them. - A trending market with weak or no real cyclicality will still return some lag as "best", even though the underlying signal may be closer to noise; treat a low, unstable reading with proportionate scepticism. - Recomputed once per closed bar using only that bar's own trailing window, so nothing here can repaint a bar that has already closed.

Indicator · MT4 · v1.0 · Free

About Dominant Cycle Period Meter

Dominant Cycle Period Meter is an indicator for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Window bars, Min period and Max period. MQL source code included.

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

Settings

SettingDefaultWhat it does
Window bars100Samples analysed per estimate
Min period4Shortest period tested, in bars
Max period50Longest period tested, in bars
Alert on big changefalseAlert once per bar when the estimate jumps sharply
Alert change bars10Minimum bar-to-bar change, in bars, that triggers the alert

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: Moving Average · Oscillator · Alerts · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria