How to get an alert when an MT5 EA stops working
Short answer: an alert that runs inside your MT5 terminal can't tell you the terminal is dead. If the VPS reboots, the terminal crashes or the connection drops, the code that would send the message stops with it. To be told, you need a check that runs somewhere else and raises the alarm when the terminal's regular signal goes missing. A missing signal is also the only dependable way to catch an EA that is running but has quietly stopped doing its job.
This guide covers the ways an EA goes quiet, what MT5's own notifications can and can't do, the heartbeat pattern traders use, and where an outside check fits.
Why EAs go quiet without telling you
Traders on the MQL5 forum describe the same case again and again. In one thread, an EA stopped trading for three days while the VPS was up and the terminal showed as connected. The owner found out by looking at the account.
There are two different failures, and they need different checks:
- The terminal is gone. The VPS restarted, the terminal crashed, or the broker connection dropped. Nothing on that machine can report it.
- The terminal is fine but the EA is stuck. It was removed from the chart, hit an error, or stopped evaluating signals. The terminal still looks healthy.
What MT5's own notifications can do
MT5 can push a message to your phone. SendNotification sends to the MetaQuotes IDs you entered in the terminal's Notifications tab. The limits are in the docs:
- No more than 2 calls per second and 10 calls per minute.
- Messages up to 255 characters.
- It doesn't work in the Strategy Tester, and notifications must be enabled in the terminal (
TERMINAL_NOTIFICATIONS_ENABLED).
That is enough to send "order failed" from inside your own EA. It cannot send "I am dead", because a dead EA runs no code. The same is true of email sent from the terminal with SendMail, which needs the SMTP settings in the terminal (TERMINAL_EMAIL_ENABLED).
TERMINAL_CONNECTED is the documented flag for the connection to the trade server. An EA can read it, but a check like that also runs only while the terminal is alive.
The heartbeat pattern
The most common advice in the forum thread is a heartbeat: the EA records the time it last finished a signal evaluation, for example in a global variable (GlobalVariableSet), and a second program checks whether that timestamp is recent. Contributors point out two good habits:
- Alert on a stale timestamp, not on "no trades". A quiet market means no trades; a healthy EA still updates its heartbeat.
- Check that the EA's open positions still exist, so a stuck EA is separate from a normal one.
The weak point is where the watcher lives. A watchdog EA on the same terminal dies with the terminal. A heartbeat is only useful if the thing that reads it sits outside the machine that can fail.
Where an outside check fits
DrawGuard is a monitor that works from outside the terminal. A free EA on one chart sends the account's equity and every open position to a web dashboard every 60 seconds. Paid plans email you when the EA stops sending data, per account, for example after a VPS restart, a broker disconnect or a crash.
What that does and doesn't cover:
| Failure | Does the outside check notice? |
|---|---|
| VPS restart or crash | Yes: the data stops, so you get the email |
| Terminal closed or broker disconnect | Yes, for the same reason |
| The DrawGuard EA removed from its chart | Yes: it stops sending |
| Another EA on the account stuck while the terminal is fine | Not by itself. Data keeps arriving, so no connectivity alert fires |
That last row matters. DrawGuard's connectivity alert watches the data feed, not each EA's decisions. If one of your trading EAs stalls while the terminal runs, no connectivity email fires. The free plan has no connectivity alerts; they are on paid plans. DrawGuard never restarts anything or closes trades. It monitors and warns.
What to set up
- Add a heartbeat to EAs you can edit, and alert on staleness, not on missing trades.
- Run one check outside the terminal so a dead VPS gets reported by someone other than the VPS.
- Use a hedging account and a unique magic number per EA, so you can see which EA's positions went quiet. Here is how to see the drawdown per magic number.
- Decide what happens next. An alert only tells you. If you also want positions closed at a loss limit, read about equity protector EAs.
FAQ
Can an MT5 EA alert me when it crashes?
No. A crashed EA or terminal runs no code, so it can't send a message. The alert has to come from a check outside the terminal that notices the signal has stopped.
Does MT5 have a built-in alert for a disconnected terminal?
Not one that works while the terminal is down. SendNotification and SendMail run inside the terminal, and TERMINAL_CONNECTED can only be read by running code.
How often can an EA send push notifications?
The MQL5 documentation allows no more than 2 calls per second and 10 per minute, with messages up to 255 characters.
Will DrawGuard tell me if one of my EAs stops trading?
Not directly. Its connectivity alert fires when the DrawGuard EA stops sending data, such as after a VPS restart or broker disconnect. It does not watch whether each of your other EAs is still making decisions.