Running 2 EAs on MT5 via VPS. Recently had one go quiet for about 3 days — no crash, no errors in Experts or Journal, smiley face still there, terminal connected. It just stopped taking trades.
I only found out because I manually check the accounts every few days. Could easily have been longer.
What I'm stuck on is the detection side, not the root cause. Uptime monitors only tell me the VPS is up. Telegram notifier EAs fire when something happens — but this is the opposite problem: nothing happens, and that's the failure. Everything reported the account as healthy the whole time.
So how do you catch this?
Do you track expected trade frequency and alert when it drops to zero? Heartbeats? Something in the logs I'm missing? Or does everyone just check manually like I do?
If there's a standard solution I've missed I'd rather use it than reinvent it.
I don't know of a readymade solution. You can use the MQL5 standard function, SendNotification(), to send a message to Mobile MT5 on your phone/mobile device:
Forum on trading, automated trading systems and testing trading strategies
my VPS is working but does not send push notifications
douglas14, 2025.03.25 20:21
Thanks , I will do these adjustments. Just a update, the sendnotification started working when I closed the metatrader5 window. The problem I reported above was happening when I did not close the terminal AND put the computer to hibernate.
Coders usually use that standard function to send notifications of executed trades but you can get your last position time and then compare it to TimeCurrent(), for example:
Forum on trading, automated trading systems and testing trading strategies
How to get Position opening time?
Yasin Ipek, 2023.08.29 18:14
double SonPozKarHesapla() { double _karToplam=0; datetime _zaman=0; for(int i=0; i<PositionsTotal(); i++) { ulong bilet=PositionGetTicket(i); long sihirliIslem=PositionGetInteger(POSITION_MAGIC); if(PositionSelectByTicket(bilet) && sihirliIslem==1923) { double _kar=PositionGetDouble(POSITION_PROFIT); datetime _zamanim=(datetime)PositionGetInteger(POSITION_TIME); if(_zamanim>_zaman) { _karToplam=_kar; _zaman=_zamanim; } } } return _karToplam; }
Running 2 EAs on MT5 via VPS. Recently had one go quiet for about 3 days — no crash, no errors in Experts or Journal, smiley face still there, terminal connected. It just stopped taking trades.
I only found out because I manually check the accounts every few days. Could easily have been longer.
What I'm stuck on is the detection side, not the root cause. Uptime monitors only tell me the VPS is up. Telegram notifier EAs fire when something happens — but this is the opposite problem: nothing happens, and that's the failure. Everything reported the account as healthy the whole time.
So how do you catch this?
Do you track expected trade frequency and alert when it drops to zero? Heartbeats? Something in the logs I'm missing? Or does everyone just check manually like I do?
If there's a standard solution I've missed I'd rather use it than reinvent it.
You could use an heartbeat system. I can't suggest a ready made solution here, but the principle is simple : you run some code on your MT5 platform that will send a heartbeat to an external system. If something goes wrong on MT5 side, the system will not received the heartbeat and you will get a notification.
Additionally the heartbeat can be linked with some information about your system, for example "no trade for X hours", and the external system can check these information with some triggers, to also send notification, even when the heartbeat is received correctly. (Though for your use case, you could do it directly with MQL5 as suggested by Ryan).
Building on Alain's heartbeat — what makes it work for this case is the payload. Andrew's point that there may simply have been no signal is the crux, and it's why I'd put state in there rather than trade counts. Two values on a timer: when the EA last finished an evaluation, and whether the positions it thinks it holds still match the order pool by ticket. Evaluated 30 seconds ago and the tickets reconcile — healthy, traded or not. Last evaluation four hours old — broken, and you know it without waiting on a trade that was never due.
Also worth checking whether the terminal restarted during those three days. Nothing logs it and everything looks normal afterwards — chart loads, indicators fill, positions in the tab, connection green. But statics and global arrays are session-scoped and come back zeroed. Usually that shows up as overtrading (empty position array, EA thinks it holds nothing, opens on top of a live basket), though it can go the other way: if your entries are gated on state built up over previous ticks, a reset leaves the gate shut and the EA just sits there evaluating and never acting. Worth ruling out before you build monitoring for it.
Boris's point about putting state in the payload rather than trade counts is the right shape. I'd add the three specific flags that catch your exact symptom, because "smiley face on, terminal connected, no errors, no trades" is usually one of them sitting at zero rather than a strategy problem.
Each of these fails invisibly:
- TerminalInfoInteger(TERMINAL_CONNECTED) — a terminal can sit open for days showing a live-looking chart while disconnected. Nothing on screen changes; every OrderSend simply fails.
- MQLInfoInteger(MQL_TRADE_ALLOWED) — AutoTrading comes back off after a terminal restart more often than people expect. The smiley face is per chart and does not tell you the global switch is off.
- AccountInfoInteger(ACCOUNT_TRADE_EXPERT) — expert trading disabled server side on the account. Nothing local shows this at all.
void OnTimer() { int h=FileOpen("health_"+IntegerToString(AccountInfoInteger(ACCOUNT_LOGIN))+".txt",FILE_WRITE|FILE_TXT); if(h==INVALID_HANDLE) return; FileWrite(h,TimeCurrent(), (int)TerminalInfoInteger(TERMINAL_CONNECTED), (int)MQLInfoInteger(MQL_TRADE_ALLOWED), (int)AccountInfoInteger(ACCOUNT_TRADE_EXPERT)); FileClose(h); }
with EventSetTimer(60) in OnInit(). Read from outside the terminal: a file older than about five minutes during market hours means the EA is not running at all; a fresh file with any of those three at zero means it is running and cannot trade. That second case is the one you are missing, and it does not require knowing the expected trade frequency.
One trap, since you are running two EAs: do not add FILE_COMMON to that FileOpen. If the two are in separate terminals, the common folder is shared between them, so both write the same file and whichever wrote last hides the other. Name the file by account login as above, or keep one portable data folder per terminal.
The one check you cannot make from inside MT5 is the VPS going dark, because a machine that is off cannot report that it is off. That has to be observed from outside the box, which is the one thing an uptime monitor is genuinely right for, even though it tells you nothing about the EA.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Running 2 EAs on MT5 via VPS. Recently had one go quiet for about 3 days — no crash, no errors in Experts or Journal, smiley face still there, terminal connected. It just stopped taking trades.
I only found out because I manually check the accounts every few days. Could easily have been longer.
What I'm stuck on is the detection side, not the root cause. Uptime monitors only tell me the VPS is up. Telegram notifier EAs fire when something happens — but this is the opposite problem: nothing happens, and that's the failure. Everything reported the account as healthy the whole time.
So how do you catch this?
Do you track expected trade frequency and alert when it drops to zero? Heartbeats? Something in the logs I'm missing? Or does everyone just check manually like I do?
If there's a standard solution I've missed I'd rather use it than reinvent it.