Moving Average Cross Price Alert Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Most cross tools tell you that a cross happened. The moving average cross price alert indicator also tells you where: each message carries the closing price of the bar that crossed. It pairs a 20-bar line with a 50-bar one, and it ships with the phone and speaker routes already switched on.

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 4: FastMA, SlowMA, Buy, Sell
Alerts popup, push notification, email, sound
Inputs 11

What the file declares

Two lines and two marks on price.

`FastMA` traces deep sky blue at width 2.

`SlowMA` traces orange beside it.

`Buy` prints lime at width 3 with arrow 233.

`Sell` prints red at width 3 with arrow 234.

Marks stand off by a share of a 14-bar range.

  • FastMA: line, deep sky blue, width 2
  • SlowMA: line, orange, width 2
  • Buy: arrow, lime, width 3, arrow code 233
  • Sell: arrow, red, width 3, arrow code 234
moving average cross price alert indicator: The 20 over 50 lines with cross marks, EURUSD H1.
The 20 over 50 lines with cross marks, EURUSD H1.

What happens behind it

Two lengths, one recipe

`FastPeriod` `20` and `SlowPeriod` `50` share `MA_Method` `MODE_EMA`. The options run from simple through smoothed and weighted to a Hull average.

Which price

`AppliedPrice` `PRICE_CLOSE` feeds both lines. Swap it for typical or median price and both lines shift together, so the cross still compares like with like.

Placing the mark

A 14-bar true range sets the gap, and `ArrowOffsetATR` `0.6` takes six tenths of it. A quiet hour keeps marks close; a fast one pushes them out.

What the states mean

Blue over orange means the 20-bar line leads.

Each mark sits on the bar that crossed.

The message quotes that bar’s close.

Only closed bars can report a cross.

Five swappable recipes change the line shapes.

Warm-up needs about fifty bars.

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

A closed-bar cross is what reports, and the message includes that bar’s close. `EnableAlerts` sits over everything; the terminal dialog, the phone route and the speaker route playing `SoundFile` all ship on, and only mail starts off.

Every Moving Average Cross Price Alert Indicator input

Core settings

Setting What it does Default
FastPeriod Fast MA period. Length of the leading line, `20`. 20
SlowPeriod Slow MA period. Length of the trailing line, `50`. 50
MA_Method 0=SMA 1=EMA 2=SMMA 3=LWMA 4=HMA. Recipe both lines use, `MODE_EMA`. MODE_EMA
AppliedPrice Price both lines read, `PRICE_CLOSE`. PRICE_CLOSE

Display settings

Setting What it does Default
ArrowOffsetATR Arrow offset = N x ATR(14). Range share used as the mark gap, `0.6`. 0.6

Alert settings

Setting What it does Default
EnableAlerts Parent switch over cross messages, `true`. on
EnablePopup Terminal dialog route, `true`. on
EnablePushNotify Phone route, on from the start, `true`. on
EnableEmail Mail route, `false`. off
EnableSound Speaker route, also on, `true`. on
SoundFile (see inputs panel) alert.wav
moving average cross price alert indicator: Inputs panel, both periods above the method list.
Inputs panel, both periods above the method list.

Choosing a market

Twenty over fifty on hourly bars gives a handful of crosses a month. EURUSD H1 is the reference chart. On M15 they come several times a week. On D1 a single cross can frame a quarter.

Where it lets you down

A quoted close is history the moment it arrives.

Crosses cluster when price goes sideways.

Both lines trail the price that bends them.

Phone and speaker routes ship on, so it gets noisy.

Copy the compiled Moving Average Cross Price Alert 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.

Related on forexmt4systems.com: Moving Average Crossover Strategy.

Download the Moving Average Cross Price Alert Indicator for MT4 and MT5

The zip holds the compiled Moving Average Cross Price Alert 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 price does the Buy message quote?

The close of the bar on which the 20-bar line crossed the 50-bar line. That makes each message self-contained: you can see where the cross happened without opening the chart.

Can MA_Method switch FastMA to a Hull average?

Yes. The setting offers simple, exponential, smoothed, weighted and Hull recipes. Hull turns fastest and simple slowest, so the choice changes how early each cross arrives.

Why do EnablePushNotify and EnableSound ship on?

Because this build is meant to reach you away from the chart. Both routes start enabled, which is unusual in this library, so switch them off if you only want the terminal dialog.

How far does ArrowOffsetATR 0.6 push a mark?

Six tenths of the 14-bar true range. Marks therefore sit further out in a fast market and closer in a quiet one, with no per-symbol tuning.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Moving Average Cross Price Alert Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Browse more Trend 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