Moving Average Cross Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Twelve and twenty-six are the MACD numbers, drawn here as plain lines on price. The moving average cross indicator marks every bar where the quicker one clears the slower one. A single setting picks between simple, exponential, smoothed and weighted averages.

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: Fast MA, Slow MA, BUY, SELL
Alerts popup, push notification, email, sound
Inputs 10

What the build shows

Two lines and two marks on price.

`Fast MA` traces dodger blue at width 2.

`Slow MA` traces orange at width 2.

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

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

Marks sit a fixed pip distance from the bar.

  • Fast MA: line, dodger blue, width 2
  • Slow MA: line, orange, width 2
  • BUY: arrow, lime, width 3, arrow code 233
  • SELL: arrow, red, width 3, arrow code 234
moving average cross indicator: Twelve over twenty-six with cross marks, EURUSD H1.
Twelve over twenty-six with cross marks, EURUSD H1.

How the source computes it

Picking the recipe

`MAMethod` `1` selects exponential. Zero gives simple, two gives smoothed and three gives linear weighted, and both lines always follow the same choice.

Seeding the lines

Each exponential line starts from a plain average of its first bars. That keeps the left edge of the chart free of a spike climbing out of zero.

The cross

`FastPeriod` `12` finishing above `SlowPeriod` `26` after sitting at or below it prints the buy. The reverse move prints the sell.

How to follow it

Blue above orange means short-term strength.

The gap between lines shows how firm it is.

Marks land on the bar that crossed.

`ArrowOffsetPips` `2.0` sets a fixed gap.

Smoothed and weighted recipes change the timing.

Warm-up needs twenty-eight bars.

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

A cross on a closed bar is what reports. `EnableAlerts` is the top-level switch; the pop-up and the desktop audio playing `SoundFile` both ship on, while mobile push and email wait.

Every Moving Average Cross Indicator input

Core settings

Setting What it does Default
FastPeriod Length of the quicker line, `12`. 12
SlowPeriod Length of the slower line, `26`. 26
MAMethod 0=SMA 1=EMA 2=SMMA 3=LWMA. Recipe code, zero to three, `1`. 1

Display settings

Setting What it does Default
ArrowOffsetPips Mark distance from the bar in pips, `2.0`. 2.0

Alert settings

Setting What it does Default
EnableAlerts Top-level switch for cross news, `true`. on
EnablePopup Pop-up in the terminal, `true`. on
EnablePushNotify Mobile push, `false`. off
EnableEmail Email, `false`. off
EnableSound Audio on the desktop, ships on, `true`. on
SoundFile Audio file used, `”alert.wav”`. alert.wav
moving average cross indicator: Inputs panel, both lengths above the recipe code.
Inputs panel, both lengths above the recipe code.

Settings that fit your chart

Twelve and twenty-six react fast enough to cross several times a week on hourly bars. EURUSD H1 is the reference chart. On M5 the lines weave constantly. On D1 a cross marks a change that usually holds for weeks.

What it will not tell you

Close lengths mean many crosses in a range.

A pip offset suits some symbols better than others.

The lines lag every turn they report.

Audio ships on, so every cross makes a sound.

Copy the compiled Moving Average Cross 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 Indicator for MT4 and MT5

The zip holds the compiled Moving Average Cross 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

Which recipe does MAMethod 1 select?

Exponential. The codes run zero for simple, one for exponential, two for smoothed and three for linear weighted, and both lines always use the same one.

Why 12 and 26 for FastPeriod and SlowPeriod?

They are the lengths Gerald Appel used inside MACD. Drawn on price instead of in a pane, their cross is the same event a MACD line crossing zero describes.

Does ArrowOffsetPips 2.0 adapt to volatility?

No, it is a fixed two pips. That reads well on major pairs but can sit too tight on gold or indices, where you may want to raise it.

Where does a SELL mark land?

Above the high of the bar on which the 12-bar line fell under the 26-bar line, two pips clear. Only closed bars count, so it never jumps mid-bar.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Moving Average Cross 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