Coding

EA Upload Setup

Try it

Standardized EA deployment for MT5: copy, compile, restart, verify. One command to deploy your MetaTrader Expert Advisor and confirm it is running with heartbeat verification.

What it does

EA Upload & Setup (DRT-Axe on MT5/Vantage) ๐Ÿช“

The skill document

EA Upload & Setup (DRT-Axe on MT5/Vantage) ๐Ÿช“

โš ๏ธ WARNING โ€” STATE-CHANGING OPERATIONS: This skill copies files into a LIVE MetaTrader 5 installation, compiles an Expert Advisor, restarts the mt5.service system service, and may commit changes to git. It can disrupt a running trading service. Do NOT run without explicit operator confirmation, and review deploy_ea.sh before first use.

Purpose: Standardized EA upload โ†’ compile โ†’ restart โ†’ attach โ†’ verify. Written 19/8 2026 after repeated failures (Boss: "you have made the same mistake several times"). FOLLOW THIS SKILL โ€” ALWAYS โ€” when the EA needs to change.

๐Ÿšจ The 3 mistakes we HAVE made (learn from them!)

  1. ArraySetAsSeries missing โ†’ CopyRates without ArraySetAsSeries(rates, true) returns the array OLDEST-FIRST. The code assumes rates[0]=newest โ†’ reads history backwards โ†’ the scan only finds OLD sweeps (e.g. 13/8) โ†’ the age gate drops EVERYTHING โ†’ 0 trades. ALWAYS check: after every CopyRates/CopyClose call, ArraySetAsSeries(arr, true) must be present (also applies to DRT.mqh's DRT_ICTBias + DRT_DailyBias + SilverBullet scan).
  2. OCR fumbling instead of DevOps scripts โ†’ NEVER use xdotool/OCR to find the Algo button manually. Run mt5-ea-fix.py (DevOps script) โ€” and if an EA dialog is open, press Enter (OK).
  3. Tokens wasted on code review โ†’ the change is typically 1-4 lines. Fix โ†’ run deploy โ†’ verify. Do NOT read the whole code first.

โšก Standard procedure (1 command)

bash /home/openclaw/.openclaw/workspace/tradevault/ea/deploy_ea.sh

The script: copies .mqh+.mq5 โ†’ MT5 โ†’ compiles (MetaEditor64 via wine+xvfb) โ†’ restarts mt5.service โ†’ verifies "DRT-Axe started" in the log.

  • โœ… SUCCESS = "EA RUNNING" + fresh heartbeat
  • โš ๏ธ "not confirmed after 5 min" = a dialog is waiting โ†’ xdotool key Return (with correct DISPLAY/XAUTHORITY)
  • โŒ compile error = fix the code, run again

๐Ÿ› ๏ธ Manual chain (if deploy fails)

MT5="/home/openclaw/.wine-mt5/drive_c/Program Files/MetaTrader 5"
EA="/home/openclaw/.openclaw/workspace/tradevault/ea"
# 1) Copy
cp "$EA"/DRT.mqh "$MT5/MQL5/Include/DRT.mqh"
cp "$EA"/SilverBullet.mqh "$MT5/MQL5/Include/SilverBullet.mqh"
cp "$EA"/Risk.mqh "$MT5/MQL5/Include/Risk.mqh"
cp "$EA"/TimeFilter.mqh "$MT5/MQL5/Include/TimeFilter.mqh"
cp "$EA"/News.mqh "$MT5/MQL5/Include/News.mqh"
cp "$EA"/Notify.mqh "$MT5/MQL5/Include/Notify.mqh"
cp "$EA"/AntiFlag.mqh "$MT5/MQL5/Include/AntiFlag.mqh"
cp "$EA"/DRT-Axe.mq5 "$MT5/MQL5/Experts/DRT-Axe.mq5"
# 2) Compile (0 errors = OK)
cd "$MT5/MQL5/Experts"
WINEPREFIX=/home/openclaw/.wine-mt5 WINEDLLOVERRIDES=mscoree,mshtml= HOME=/home/openclaw \
  xvfb-run -a wine "$MT5/MetaEditor64.exe" /compile:"DRT-Axe.mq5" /log:"compile_deploy.log" >/dev/null 2>&1
sleep 12
iconv -f UTF-16LE -t UTF-8 compile_deploy.log | grep "Result:"
# 3) Restart + verify
sudo systemctl restart mt5.service
sleep 150   # login ~60s + attach
tail -5 "$MT5/MQL5/Files/DRT-Axe_Log.txt"   # should show "DRT-Axe started โ€” 17 symbols"

๐Ÿ” Verification (ALWAYS after deploy)

CheckCommandOK sign
EA runsgrep "started" DRT-Axe_Log.txt | tail -1today's date + "17 symbols"
Fresh heartbeatstat -c %y DRT-Axe_HB.txt< 2 min old
Fresh scantail DRT-Axe_Log.txtsweeps with TODAY's prices (not 13/8 levels)
Algo ONmt5-algo-ensure.py"EA heartbeat fresh โ€” Algo is ON"

๐ŸชŸ If a dialog is waiting (EA properties)

  • Symptom: EA loaded but "started" missing / HB frozen
  • Fix: find DISPLAY+XAUTHORITY, press Enter:
export DISPLAY=:99 XAUTHORITY=$(ps aux | grep 'Xvfb :99' | grep -v grep | grep -oE '\-auth [^ ]+' | awk '{print $2}' | head -1)
xdotool key Return

๐Ÿ“ Fixed paths

  • EA code (edit ONLY here): /home/openclaw/.openclaw/workspace/tradevault/ea/
  • MT5 folder: /home/openclaw/.wine-mt5/drive_c/Program Files/MetaTrader 5
  • EA log: $MT5/MQL5/Files/DRT-Axe_Log.txt (server time GMT+3 = UTC+3)
  • Heartbeat: $MT5/MQL5/Files/DRT-Axe_HB.txt
  • Data for the bot: $MT5/MQL5/Files/DRT-Axe_Data.json (written every 60s)
  • DevOps scripts: /home/openclaw/.local/bin/mt5-ea-fix.py, mt5-ea-attach.sh, mt5-login-helper.sh, mt5-algo-ensure.py (cron every 2 min)

โฐ Trading windows (entries)

London 09-11 ยท NY open 14:30-17:00 ยท SB PM 19:30-21:00 (CET/Danish time). Night pause 23-08. Outside windows = no entries โ€” that is by design, not a bug. Expect trades in the NY/PM windows.

๐Ÿ“Œ Rules for EA changes (Boss 19/8)

  1. Make the CHANGE (typically a few lines) โ€” do not read the whole code
  2. Run deploy_ea.sh โ€” not manual OCR fumbling
  3. Verify with the table above
  4. Commit: git add tradevault/ea/ && git commit -m "EA fix: ..." (part of the workspace repo)
  5. Report briefly: what was changed + proof that it is running

Related skills

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

by nssa.io1.0k installs47 stars

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

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