HMA Color with Alerts Indicator: A Faster Kind Of Line

Written by Dominic Walsh · Published · Last updated

The hma color with alerts indicator uses Alan Hull’s average rather than an ordinary one. The construction cancels most of the lag a weighted average carries. Colour then reports which way the line is currently pointing.

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 Main price chart
Plots 2: HMA Rising, HMA Falling
Alerts popup, push notification, email, sound
Inputs 7

What the HMA Color with Alerts Indicator draws on the chart

`HMA Rising` carries the line in dodger blue while the slope points up.

`HMA Falling` takes over in orange red when it turns down.

The two buffers bridge at the join, so the line never breaks.

No marks and no pane ship with this build.

  • HMA Rising: line, dodger blue, width 2
  • HMA Falling: line, orange red, width 2
Hma color with alerts indicator slope-coloured Hull line on the EURUSD H1 chart.
Hma color with alerts indicator slope-coloured Hull line on the EURUSD H1 chart.

How the HMA Color with Alerts Indicator calculates its values

Two weighted averages, then a third

iMA gives a weighted average at `HmaPeriod` `20` and another at half that length. Doubling the half and subtracting the full produces a raw series that overshoots on purpose.

The square root smooths it back

A final weighted pass runs over that raw series, its length the square root of the period. Four bars at the default. That last step removes the overshoot while keeping the speed.

Colour follows the slope

Comparing the value against the previous bar decides which buffer receives it. A rising line goes blue and a falling one goes red, and the flip is what raises the alert.

How to read the signals

A twenty-bar Hull line turns sooner than a twenty-bar exponential one.

Speed comes at the cost of more flips in a range.

Colour is a statement about the line, never about where price sits.

A flip confirms one bar after the turn it describes.

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

`EnableAlerts` is the parent toggle and starts true with `EnablePopup`. Switch `EnablePushNotify` for a handset alert, `EnableEmail` for mail, or `EnableSound` to play `SoundFile`. Those three arrive off. Flips report once a bar.

Every HMA Color with Alerts Indicator input

Core settings

Setting What it does Default
HmaPeriod Bars in the full weighted average, default `20`. 20

Alert settings

Setting What it does Default
EnableAlerts Parent toggle for the flip alerts, default `true`. on
EnablePopup Terminal box on a colour flip, default `true`. on
EnablePushNotify Handset alert on a colour flip, default `false`. off
EnableEmail Mail on a colour flip, default `false`. off
EnableSound Sound clip on a colour flip, default `false`. off
SoundFile Clip filename, default `”alert.wav”`. alert.wav
Hma color with alerts indicator inputs panel showing HmaPeriod and the alert switches.
Hma color with alerts indicator inputs panel showing HmaPeriod and the alert switches.

Settings that fit your chart

A Hull line suits charts where turns matter. EURUSD H1 is the reference chart, where the colour flips every day or two. On M5 it flips constantly. Daily bars turn each flip into a swing-scale event.

When the HMA Color with Alerts Indicator fails

Less lag means the line reacts to spikes that go nowhere.

A sideways market produces colour flips with no move behind them.

Only one input exists, so there is very little to tune.

Copy the compiled HMA Color with Alerts 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.

Background reading on the method behind the HMA Color with Alerts Indicator: Hull Moving Average Hma at StockCharts ChartSchool, Attribution analysis on Wikipedia.

Download the HMA Color with Alerts Indicator for MT4 and MT5

The zip holds the compiled HMA Color with Alerts 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

What makes HmaPeriod 20 faster than an EMA?

The construction deliberately overshoots by doubling a half-length average and subtracting the full one, then smooths that result with a short final pass. The overshoot cancels the lag rather than averaging it away.

Why does HmaPeriod need a square root pass?

Without it the raw series would be far too jumpy to read. Running a short weighted pass over it, four bars at the default, removes the noise the overshoot introduced while keeping the speed it bought.

Why do HMA Rising and HMA Falling share a bar?

So the coloured line has no gap at a flip. The code writes the previous value into whichever buffer takes over, which bridges the join and keeps the plot continuous.

Should I raise HmaPeriod for fewer flips?

Yes, that is the only lever here. A forty or fifty-bar setting flips far less often and still turns sooner than an exponential average of the same length would.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the HMA Color with Alerts Indicator as one input. Always backtest before trading live.

Category: this is part of our Signal and Forecast collection. Also, browse more Signal and Forecast 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