This EMA crossover alert indicator plots two exponential moving averages on the price chart. It marks every cross between them with an arrow. EMA Fast runs at 5 periods and EMA Slow at 20 by default. The tool suits traders who want a plain trend trigger with a popup, push, email or sound alert attached. It runs on MT4 and MT5 as a chart overlay.
This build ships as ema-crossover-alert-indicator-forexmt4systems.ex4 for MT4 and ema-crossover-alert-indicator-forexmt4systems.ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 4: EMA Fast, EMA Slow, Bullish Cross, Bearish Cross |
| Alerts | popup, push notification, email, sound |
| Inputs | 10 |
What the Ema crossover alert Indicator draws on the chart
EMA Fast is the deep sky blue line. It follows price closely with its 5-period length. EMA Slow, the orange-red line, smooths the same price over 20 periods and lags behind. Both lines come straight from the platform’s iMA function, so they match the standard Moving Average from the Navigator.
Bullish Cross is a lime arrow, code 233. It sits InpArrowGapPoints points below the low of the bar where the fast line crosses above the slow line. Bearish Cross is a red arrow, code 234, above the high where the fast line drops below the slow. Both arrows draw at width 3, so they stand out on a dark chart.
- EMA Fast: line, deep sky blue, width 2
- EMA Slow: line, orange red, width 2
- Bullish Cross: arrow, lime, width 3, arrow code 233
- Bearish Cross: arrow, red, width 3, arrow code 234

How the Ema crossover alert Indicator calculates its values
Two EMAs from iMA
iMA does the work. On every bar the code asks it for the fast EMA over InpFastPeriod bars. It then asks for the slow EMA over InpSlowPeriod bars. Both use InpAppliedPrice, which defaults to PRICE_CLOSE. The values land in the EMA Fast and EMA Slow buffers without extra smoothing. Because the platform computes the EMA, the lines match the default Moving Average tool with the same settings.
Spotting the cross
For each bar the code also pulls both EMAs one bar earlier. A Bullish Cross needs the fast value at or below the slow value on the previous bar. On the current bar it must be above. A Bearish Cross is the mirror: fast at or above slow before, then below. The arrow goes on the bar where the cross completes. Buys sit at low minus the gap, sells at high plus the gap.
Warm-up and recalculation
The first bars of the chart get no values. The warm-up equals the longer of the two periods plus two bars, so 22 bars with the defaults. On later ticks only the newest bars recalculate, which keeps the indicator light on long histories.
How to read the signals
A lime Bullish Cross arrow means the 5 EMA moved above the 20 EMA. Trend followers read that as the short-term push turning up. They then look for long entries on the next pullback toward the fast line.
A red Bearish Cross arrow above a candle shows the fast line dropping under the slow. The gap between the two lines after the cross tells you how much momentum sits behind it. A wide, fast-opening gap is a stronger move than two lines that hug each other.
Between crosses, the order of the lines gives the bias. Blue above orange favours longs and orange above blue favours shorts. A stretch where the lines keep touching is the classic chop zone to skip.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Alerts fire once per closed bar through popup, push notification, email and sound. Each channel has its own on/off input.
Every Ema crossover alert Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpFastPeriod |
Fast EMA period. InpFastPeriod (default 5) sets the EMA Fast length. Try 8 or 10 to slow the line and cut the crosses. | 5 |
InpSlowPeriod |
Slow EMA period. InpSlowPeriod (default 20) sets EMA Slow. Stretch it to 50 for a swing-style cross that fires far less often. | 20 |
InpAppliedPrice |
Applied price. InpAppliedPrice (default PRICE_CLOSE) chooses which price feeds both averages; PRICE_MEDIAN or PRICE_TYPICAL smooths out a little wick noise. | PRICE_CLOSE |
Display settings
| Setting | What it does | Default |
|---|---|---|
InpArrowGapPoints |
Arrow offset (points). InpArrowGapPoints (default 6.0) sets the arrow offset in points. Raise it on gold or indices so the arrow clears the wick. | 6.0 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpEnableAlerts |
Master alert switch. | on |
InpEnablePopup |
Popup alert. | on |
InpEnablePushNotify |
Push to mobile. | on |
InpEnableEmail |
Email alert. | off |
InpEnableSound |
Audible alert. | on |
InpSoundFile |
Sound file. | alert.wav |

Settings that fit your chart
The screenshots use EURUSD H1. There the 5/20 pair crosses a few times a week and the alerts stay manageable. On M5 and M15 the same settings fire many times a session. Most intraday users lengthen InpSlowPeriod there or filter by session. On H4 and D1 the crosses are rare and late, but they line up with the larger swing. Any MT4 or MT5 symbol works because the lines come from iMA; indices and gold only need a larger InpArrowGapPoints.
When the Ema crossover alert Indicator fails
Sideways markets. When price drifts in a range the two EMAs braid around each other. The tool then prints a cross every few bars. Each arrow flips the bias back, and a trader who follows every one pays the spread for nothing.
Lag. An EMA cross confirms a move that already started. By the time the 5 crosses the 20 on H1, a good share of the swing is often done. The slower the pair of periods, the later the arrow.
Mid-bar movement. The cross test runs on the current bar as well. An arrow can therefore appear mid-bar and vanish if price pulls back before the close. Arrows on closed bars stay put. The alert only fires for the last closed bar, so wait for the close.
Copy ema-crossover-alert-indicator-forexmt4systems.ex4 into MQL4/Indicators and ema-crossover-alert-indicator-forexmt4systems.ex5 into MQL5/Indicators, then restart the terminal and drag the Ema crossover alert Indicator 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 Ema crossover alert Indicator: Moving average crossover on Wikipedia, Msci Indices at StockCharts ChartSchool.
Download the Ema crossover alert Indicator for MT4 and MT5
The zip ema-crossover-alert-indicator-forexmt4systems.zip holds ema-crossover-alert-indicator-forexmt4systems.ex4, ema-crossover-alert-indicator-forexmt4systems.ex5 and a short README, compiled files only. 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.
FAQ
Does the EMA Fast line match the standard MT4 moving average?
Yes. The buffer takes its value straight from iMA with MODE_EMA, the same call the built-in Moving Average uses. Set a standard MA to period 5, method Exponential, applied to close. It will sit on top of the deep sky blue line. The same holds for EMA Slow at 20.
Why did a Bullish Cross arrow appear and then disappear?
The cross test also runs on the bar that is still open. Say the fast line pokes above the slow during the bar and drops back before the close. The arrow then clears again. Closed-bar arrows never change. The alert only fires for the last closed bar, so it never chases a flicker.
Which InpSlowPeriod works better for swing trading on H4?
Many swing traders move InpSlowPeriod from 20 to 50 and leave InpFastPeriod at 5 or 10. The cross then marks a shift in the multi-week trend instead of a two-day wobble. Fewer arrows print and each one sits later in the move. Pair it with a pullback entry rather than chasing the arrow bar.
Can you run the ema crossover alert indicator on gold with the default arrow gap?
You can, but the arrows will sit inside the wicks. InpArrowGapPoints is 6.0 by default. That means six points on a five-digit forex quote and almost nothing on XAUUSD. Raise it to 50 or more on gold and indices. The Bullish Cross and Bearish Cross markers then clear the candle.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Ema crossover alert Indicator as one input. Always backtest before trading live.
Category: this is part of our Trend collection. Also, truly, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in Moving average crossover on Wikipedia.
- Additional market context is at Msci Indices at StockCharts ChartSchool.
