Machine Learning Momentum Index Indicator: Z-Scored ROC

Written by Dominic Walsh · Published · Last updated

The machine learning momentum index indicator holds plain statistics. No learning happens here, and that is worth saying up front. Rate of change gets weighted by a volume ratio. The code then scores that against its own last sixty readings. A squash maps the score onto 0 to 100.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Separate window (levels 30 / 50 / 70)
Plots 3: MLMI, Signal, RawMom
Alerts popup, push notification, email, sound
Inputs 12

What the Machine Learning Momentum Index Indicator draws on the chart

MLMI is the deep sky blue line, smoothed at `InpEmaPeriod` bars.

Signal is the orange line, a second smoothing of that reading.

RawMom is the silver line, showing the value before smoothing.

Reference lines mark 30, 50 and 70.

  • MLMI: line, deep sky blue, width 2
  • Signal: line, orange, width 1
  • RawMom: line, silver, width 1
Machine learning momentum index indicator on EURUSD H1 with the standardised line
Machine learning momentum index indicator on EURUSD H1 with the standardised line

How the Machine Learning Momentum Index Indicator calculates its values

Weighting rate of change

roc takes the current close against the close `InpRocPeriod` `14` bars back, as a percent. vRatio compares recent tick volume with the older half of the same window. rawMom multiplies the two.

Scoring the result

The code takes the mean and spread of the raw value over `InpZNormLookback` `60` bars. z then takes rawMom minus the mean, over the spread. A squash maps that onto 0 to 100.

Two smoothing passes

BufMLMI smooths the squashed value at `InpEmaPeriod` `9`, seeded with a plain mean. BufSig smooths that line again at `InpSignalPeriod` `5`. Crossings between the two are what the alert watches.

How to read the signals

A z-score turns an unbounded reading into one you can compare across weeks.

The silver line shows how much the two smoothing passes take out.

Above `InpUpperLevel` `70.0` the reading is unusual by its own recent standards.

Tick volume is a proxy for activity, not a count of contracts.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

`EnableAlerts` ships off, so nothing fires until you turn it on. `EnablePopup` and `EnableSound` are already true underneath it. `EnablePushNotify` and `EnableEmail` are false. `InpAlertSound` picks the clip. One message follows each closed bar.

Every Machine Learning Momentum Index Indicator input

Core settings

Setting What it does Default
InpRocPeriod Rate-of-change lookback. Rate of change lookback, default `14`. 14
InpZNormLookback Z-score normalization window. Bars in the standardisation window, default `60`. 60
InpEmaPeriod Smoothing EMA period. First smoothing pass, default `9`. 9
InpSignalPeriod Signal-line EMA period. Signal line smoothing, default `5`. 5
InpUpperLevel Overbought. Upper reference level, default `70.0`. 70.0
InpLowerLevel Oversold. Lower reference level, default `30.0`. 30.0

Alert settings

Setting What it does Default
EnableAlerts Master alert toggle. Master toggle, default `false`. Nothing fires until you switch it on. off
EnablePopup Popup alert. Terminal dialog on an index cross, default `true`. on
EnableSound Sound alert. Sound playback on an index cross, default `true`. on
EnablePushNotify Push notification. Phone push on an index cross, default `false`. off
EnableEmail Email alert. Mail delivery on an index cross, default `false`. off
InpAlertSound Wav clip for the index alert, default `alert.wav`. alert.wav
Machine learning momentum index indicator inputs: InpRocPeriod, InpZNormLookback, InpEmaPeriod
Machine learning momentum index indicator inputs: InpRocPeriod, InpZNormLookback, InpEmaPeriod

Settings that fit your chart

A sixty-bar score needs a steady stretch to measure against. EURUSD H1 is the reference chart, where that window covers two and a half days. On M5 the reference resets within a session. On H4 it spans a fortnight and settles.

When the Machine Learning Momentum Index Indicator fails

Nothing here is trained. The name describes marketing, not method.

Tick volume differs by broker, so the weighting does not travel.

A z-score assumes the recent window is typical. That fails at a regime change.

Copy the compiled Machine Learning Momentum Index Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Machine Learning Momentum Index Indicator for MT4 and MT5

The zip holds the compiled Machine Learning Momentum Index Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

Does the InpEmaPeriod line use machine learning?

No. The code takes rate of change and weights it by a volume ratio. It then scores that and smooths it twice. No model gets trained. No weights get learned. The name is marketing.

What does InpZNormLookback at 60 standardise against?

The previous sixty raw values. The code takes their mean and spread. It then states the current value as a distance from that mean. Sixty bars on EURUSD H1 is two and a half days.

How does InpRocPeriod split the volume ratio?

It sets the window the split runs over. vRatio compares tick volume in the recent half against the older half. A busier recent half pushes the ratio above 1 and lifts the reading. A quieter one damps it.

Why does EnableAlerts ship as false?

Because the line crosses its levels fairly often once smoothed. Most people want to watch it first. `EnablePopup` and `EnableSound` are already true, so the master switch turns on two channels at once.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Machine Learning Momentum Index Indicator as one input. Always backtest before trading live.

Category: this is part of our Oscillators collection. Browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment