How do you detect when an EA silently stops trading?

 

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.

 
123bernardino:

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;
  }
The idea is to write some code in your EA that conditionally sends a notification if your last position time is greater than 2 days ago, or whichever length of time that you prefer.
 
Blemoragne Catayas:

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).