How do you detect when an EA silently stops trading? - page 2

I run EAs on several accounts too, and honestly this is the failure that worries me most. A crash you notice. Silence you don't.

It just happened to me. I keep all my accounts in one overview, and one of them showed no trades for 13 days while the others were trading normally.
I saw it, but I explained it away: weekend, and one of my VPS had crashed a few days before, so I thought that terminal was just behind. When I finally looked, the terminal seemed fine, but no new trades came in and open positions weren't closed either.
Updating the EA and restarting the terminal fixed it, and in the log I saw it had skipped a few updates. A developer I know has seen the same and once had to reinstall the terminal completely.

So my lesson wasn't really about detection, the data was there.
It was that a quiet account next to accounts that do trade is the signal, and I should check it right away instead of finding reasons why it's fine.

For a threshold I'd use the gaps between trades in the EA's own history:
if it was never quiet for more than 2 days and now it's 4, look at it. That should give far fewer false alarms than a fixed "no trade for X hours", which I think is what Dominik was warning about.

Maybe it could helps... 
Chris
Heartbeats tell you the EA is alive, but not whether silence is abnormal for that strategy. Split the account history by magic number (HistorySelect, then read DEAL_MAGIC for each deal) and, for each EA, compute the gaps between consecutive entries over the last 6-12 months. Take the 95th or 99th percentile of that gap as the alert threshold. Three days of silence is normal for one EA and a failure for another, and a fixed threshold will either spam you or miss it. Alert when the current gap passes that percentile, and compare it with the market state, since a closed market or a symbol with no ticks is a different problem from an EA that has stopped evaluating. Also log the last signal evaluation time inside the EA, so you can tell "no setup" from "not running". If a terminal restart is possible, persist the state in a file or global variable, because static variables reset on restart and can block entries silently.