The ema alert indicator does one job and stays out of the way. A single 20 period EMA sits on the chart. Whenever the closing price crosses it, the tool marks the bar and tells you. There is no second average and no filter. It suits traders who already have a method and want a reliable notification instead of a screen to watch all day.
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 | 3: EMA, BUY, SELL |
| Alerts | popup, push notification, email |
| Inputs | 4 |
What the Ema alert Indicator draws on the chart
EMA is a single dodger blue line at the period you set.
BUY places a lime arrow beneath a bar that closed above the line having been below it.
SELL places a red arrow above the bar on the downward cross.
Arrow spacing is fixed at 20 points in the code, so there is no offset input to tune.
- EMA: line, dodger blue, width 2
- BUY: arrow, lime, width 2, arrow code 233
- SELL: arrow, red, width 2, arrow code 234

How the Ema alert Indicator calculates its values
One average, read twice
ema_now comes from iMA over `InpEmaPeriod` on the close, and ema_prev reads the same average one bar back. Using MetaTrader’s own function rather than a hand-rolled recursion means the line matches any other EMA on your chart at the same period.
Comparing price to the line across two bars
close_now and close_prev hold the two closes. cross_up requires close_prev at or below ema_prev and close_now above ema_now. cross_down mirrors it. Comparing each close against the average as it stood on that same bar matters, because the EMA moves too. Testing both closes against today’s value would produce false crossings.
Alerting from settled bars
The alert path reads its own values rather than reusing the drawing loop. It calls iMA at shift 1 and shift 2 for ema_now and ema_prev. It takes cn from close[1] and cp from close[2]. Working one bar back from the live candle means the message describes a bar that has finished. That bar cannot change.
How to read the signals
A cross is a change of side, nothing more. The tool takes no view on whether it will hold.
Price hugging the line produces repeated arrows, and that is a fair description of an indecisive market.
Because the arrow sits a fixed 20 points from the candle, the spacing looks different across instruments with different point sizes.
The line itself is worth watching as often as the arrows, since a sloping EMA and a flat one mean different things.
Alert channels in this build: popup, push notification and email, one message per closed bar.
Three channels ship in this build: a terminal popup, a push notification to the MetaTrader mobile app, and email. `InpEnableAlert` is the master switch and starts on, while `InpPushAlert` and `InpEmailAlert` both start off. There is no sound option here. Every message comes from a settled bar and the guard allows one per closed bar.
Every Ema alert Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpEmaPeriod |
EMA period. The only calculation input, default `20`. Common alternatives are 50 for a slower read and 9 for a faster one. | 20 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpEnableAlert |
Enable alerts. Master switch for notifications, `true` out of the box. | on |
InpPushAlert |
Push notifications. Sends the message to the MetaTrader mobile app, `false` by default. | off |
InpEmailAlert |
Email alerts. Sends the same message by email, also `false` until you configure MetaTrader’s mail settings. | off |

Settings that fit your chart
A single EMA cross fits any timeframe where you already use moving averages. EURUSD H1 is the reference chart. A 20 period line there covers most of a trading day. On M5 price crosses it many times a session, which suits the alerting purpose if you bring your own filter. On the daily chart crossings are rare and each one carries more weight.
When the Ema alert Indicator fails
One average with no filter reports every crossing. Many of them reverse on the next bar.
In a range, price oscillates around the line and the tool produces a steady stream of alternating signals.
The fixed 20 point arrow gap suits a 5-digit forex pair. On gold or an index the arrows sit almost on the candles.
Copy the compiled Ema 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.
Download the Ema alert Indicator for MT4 and MT5
The zip holds the compiled Ema 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.
FAQ
How do I get InpPushAlert working on my phone?
Set it `true`, then open Tools, Options, Notifications in MetaTrader and enter the MetaQuotes ID shown in the mobile app’s messages screen. Send a test from that dialog before relying on it. The indicator itself only calls the notification function; delivery depends entirely on that terminal setting being correct.
Why does the alert read close[1] and close[2] rather than the current bar?
So the message describes something that has finished. The forming candle can cross the line and cross back before it closes, which would produce an alert for an event that never happened. Reading one bar back means the cross being reported is settled and the arrow beside it will not move.
What is a good InpEmaPeriod for intraday work?
The default `20` is a reasonable middle. On H1 it tracks about a day of trading. Traders wanting fewer, slower signals often move to 50. Those wanting an earlier read use 9 or 10 and accept more crossings. The tool draws whatever period you set, so try a couple on your own chart.
Does the ema alert indicator have a trend filter?
No, and that is deliberate. It reports every close that crosses the EMA line, in both directions, with no second average or oscillator gating it. Most people run it as a notification layer beneath their own analysis rather than as a standalone signal source.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Ema 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
- Learn more about the underlying method in EMA at Investopedia.
- For wider market background, see Foreign exchange date conventions on Wikipedia.
