Loading…

Cycle Phase Dial

Most "cycle" indicators ask the trader to type in a period and simply trust it. This one estimates the dominant cycle length itself: price is detrended against its own moving average to build an oscillator, that oscillator is correlated against a delayed copy of itself across a range of candidate lags, and the lag with the strongest correlation is taken as the current dominant cycle length. The estimate is smoothed bar to bar with a short EMA so it does not jump around on noise alone. Phase is then measured as bars elapsed since the oscillator's most recent confirmed trough, scaled to 0-360 degrees by that estimated length, and shown on a genuine circular dial rather than a number. The dial is built from ordinary chart-corner label objects placed by simple trigonometry - MQL4 has no pixel-anchored circle object - which keeps the gauge pinned in the corner regardless of how far the chart is scrolled or zoomed. Twelve ring markers are coloured by third of the circle (early, peak, late) and a single bright needle marker shows the live phase angle. Notes and limitations - Financial markets do not have a truly fixed, guaranteed cycle the way an audio signal does - the autocorrelation estimate is a statistical best fit over the lookback window, not a proven periodicity, and it will wander or flatten out during genuinely trending or genuinely random stretches. - The dial needs InpAutocorrLookback + InpMaxCyclePeriod + InpDetrendPeriod bars of history before it draws anything; on a fresh chart with limited history it will stay blank until enough bars load. - This is a read of current cyclical position, not a trade signal - it does not imply a reversal is due at any particular phase, only where in the estimated cycle price currently sits.

Indicator · MT4 · v1.0 · Free

About Cycle Phase Dial

Cycle Phase Dial is an indicator for MetaTrader 4 based on Moving Average. It has 9 settings, such as Min cycle period, Max cycle period and Detrend period. MQL source code included.

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

Settings

SettingDefaultWhat it does
Min cycle period8Shortest cycle length considered, in bars
Max cycle period50Longest cycle length considered, in bars
Detrend period20SMA period subtracted from price to build the oscillator
Autocorr lookback200Bars of oscillator history used for the autocorrelation scan
Smooth period5EMA smoothing applied to the raw cycle-length estimate
Dial radius55Dial radius in pixels
Corner x110Dial centre X offset from the chosen corner (must exceed radius)
Corner y110Dial centre Y offset from the chosen corner (must exceed radius)
CornerCORNER_RIGHT_UPPERChart corner the dial is anchored to

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 · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria