Coding

MT5 Headless Automation

Try it

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

What it does

Run MetaTrader 5 on a server WITHOUT a screen — full EA automation 24/7.

The skill document

MT5 Headless Automation 🖥️🤖

Run MetaTrader 5 on a server WITHOUT a screen — full EA automation 24/7.

⚠️ Important (read first)

  • System-level actions: this skill installs packages (sudo apt), starts Xvfb/Wine, and runs shell scripts. Review before running on production.
  • Restarts can interrupt trading: the watchdog auto-restarts MT5 and may terminate EA processes during active sessions — this can detach strategies or affect open positions.
  • Credentials: broker login (terminal64.exe via Wine) uses your MT5 account/password. They are entered into the terminal and may appear in process arguments or logs — store them in env vars or a protected file, never in scripts committed to git. Use a read-only/demo account for testing.
  • Built from production experience — but backtest/production results are historical and not guaranteed.

What this skill does

  1. Install MT5 + Wine + Xvfb (headless display)
  2. Log in to broker account (terminal64.exe via Wine)
  3. Attach EAs via Navigator (Ctrl+N → OCR → double-click → Enter)
  4. Deploy EA changes with 1 command (copy → compile → restart → verify)
  5. Monitor heartbeat — auto-restart if the EA hangs
  6. Avoid the 5 classic pitfalls (documented below)

Quick start

# 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

The 5 classic pitfalls (we have hit them ALL)

#PitfallSymptomFix
1ArraySetAsSeries missingEA reads history backwards → 0 tradesArraySetAsSeries(rates, true) after every CopyRates
2EA unloads on MT5 restart"EA running" but HB file frozenAttach MANUALLY after each restart (auto-attach unreliable)
3Log freshness ≠ EA runningFalse positive in monitorCheck HB file mtime, not log lines
4pkill -f kills itselfScript dies suddenlypkill -f "pa[t]tern" or kill $(lsof -ti:PORT)
5xdotool coordinates changeClick on wrong placeOCR-find the element each time (tesseract + tsv)

Files

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

Verification (always!)

  • EA log: MQL5/Files/_Log.txt (server time GMT+3)
  • Heartbeat: _HB.txt — mtime must be < 60 sec old
  • Data: _Data.json (real-time klines every 60s)
  • ex5 MD5 must match workspace copy after deploy

Related skills

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai21 installs8 stars

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván1 installs

More from northcap-group

Browse all skills

Dealing Range Theory (DRT) — complete ICT structure: Type 1 (continuation), Type 2 (reversal), Type 3 (consolidation), quadrant levels (25/50/75), entry models, SMT confirmation and news filter. For market analysis and trade setups.

by Northcap Group2 installs1 stars

Crypto DRT scalping strategy + backtest reference on 12 crypto pairs (TRX, BNB, BTC, LINK, AVAX, DOGE, SOL, NEAR, XRP, LDO, ADA, ETH), all 7 days. Backtested 2 years (~400+ trades). 100% lokal backtest-reference — ingen netværkskald, ingen API-nøgle. Backtest results are historical and not a guarantee of future performance.

by Northcap Group2 installs1 stars

Provides pay-per-call crypto trading signals with entry, stop-loss and take-profit via the x402 standard (USDC on Ethereum). Live DRT/ICT signals for agents and traders.

by Northcap Group1 installs1 stars

How the world's best entrepreneurs network, negotiate, and create partnerships. Relationships that build millions.

by northcap-group

Crypto DRT scalping — Dealing Range Theory on 12 crypto pairs (TRX, BNB, BTC, LINK, AVAX, DOGE, SOL, NEAR, XRP, LDO, ADA, ETH), all 7 days. Backtested 2 years (~400+ trades). Backtest results are historical and not a guarantee of future performance. Separate play-money account rules.

by northcap-group

How to build wealth from zero — bootstrapping, scaling strategies, resource allocation, and wealth mindset. Strategic advisory for Mohamed.

by northcap-group