My EA survived a VPS crash mid-trade because of this watchdog setup
Last month my VPS provider had a "brief maintenance event" at 2am my time — 40 minutes of downtime with three positions open and no stops on the broker side (my EA manages exits internally; mistake #1).
What saved me was a watchdog setup refined over two years. Posting it because "just use a VPS" is incomplete advice:
- MT5 terminal runs as a service and auto-restarts on boot (NSSM, 5 minutes to set up)
- A Python watchdog checks the terminal's log file every 60s; if no heartbeat write in 3 minutes, it kills and restarts the terminal
- Every position gets a catastrophic stop-loss on the broker side, 3x wider than the EA's managed stop — almost never hit, but it is the difference between a bad fill and a margin call when the machine is dead
- A Telegram alert fires on every watchdog restart, so I know within a minute
Total damage: one position closed 9 pips worse than intended. Without the broker-side catastrophic stops it would have been a coin flip.