Install
openclaw skills install @northcap-group/mt5-headless-automationRun MetaTrader 5 (MT5) fully headless on Linux/VPS: Wine + Xvfb + xdotool + OCR. Install, log in, attach EAs, deploy experts, monitor heartbeat and auto-restart. Built from real production experience (Vantage, 17 symbols, DRT-Axe EA). Perfect for traders who want to run EAs 24/7 without a screen. ⚠️ WARNING: runs system-level commands (wine, Xvfb, sudo apt), can restart MT5/terminate processes, and handles broker login credentials.
openclaw skills install @northcap-group/mt5-headless-automationRun MetaTrader 5 on a server WITHOUT a screen — full EA automation 24/7.
# 1) Environment
sudo apt install wine xvfb xdotool tesseract-ocr scrot
Xvfb :99 -screen 0 1280x720x24 &
export DISPLAY=:99
# 2) Install MT5 (Windows installer via Wine)
wine "mt5setup.exe" /auto
# 3) Attach EA (scripts/attach_ea.sh)
bash scripts/attach_ea.sh "DRT-Axe"
# 4) Deploy new EA version (scripts/deploy_ea.sh)
bash scripts/deploy_ea.sh
| # | Pitfall | Symptom | Fix |
|---|---|---|---|
| 1 | ArraySetAsSeries missing | EA reads history backwards → 0 trades | ArraySetAsSeries(rates, true) after every CopyRates |
| 2 | EA unloads on MT5 restart | "EA running" but HB file frozen | Attach MANUALLY after each restart (auto-attach unreliable) |
| 3 | Log freshness ≠ EA running | False positive in monitor | Check HB file mtime, not log lines |
| 4 | pkill -f kills itself | Script dies suddenly | pkill -f "pa[t]tern" or kill $(lsof -ti:PORT) |
| 5 | xdotool coordinates change | Click on wrong place | OCR-find the element each time (tesseract + tsv) |
mt5-headless-automation/
├── SKILL.md
└── scripts/
├── attach_ea.sh # OCR-guided EA attach via Navigator
├── deploy_ea.sh # 1-command: copy → compile → restart → verify
├── watchdog.sh # Heartbeat check + auto-restart
└── ea_fix.py # Diagnose why the EA is not trading
MQL5/Files/<EA>_Log.txt (server time GMT+3)<EA>_HB.txt — mtime must be < 60 sec old<EA>_Data.json (real-time klines every 60s)