2026-04-18 11:41:41 +07:00
# Remote Agent Setup (Linux Server)
MT5's distributed testing lets you farm optimization work across multiple machines. A Linux server running `metatester64.exe` via Wine connects to a Mac master over a local network.
**Throughput:** Each agent handles one pass at a time. 10 local + 16 remote = 26 agents. A 17,000-combination genetic optimization that takes 3 hours locally finishes in ~70 minutes.
---
## Requirements
**Mac (master)**
- MetaTrader 5 installed via CrossOver or Wine
- MT5-Quant configured and working for local backtests
2026-06-25 14:49:30 +07:00
- Port 3000 open in macOS firewall (or whichever port MT5 uses)
2026-04-18 11:41:41 +07:00
**Linux server (agents)**
2026-06-25 14:49:30 +07:00
- Wine 7.0+
2026-04-18 11:41:41 +07:00
- `metatester64.exe` from an MT5 installation
2026-06-25 14:49:30 +07:00
- Access to the same MT5 data files (tick history) as the master
2026-04-18 11:41:41 +07:00
## Step 1: Find the MT5 agent port on Mac
After running a local optimization, check the MT5 agent directories:
```bash
ls ~/Library/Application\ Support/MetaQuotes/*/drive_c/Program\ Files/MetaTrader\ 5/
```
You'll see directories like:
```
Agent-127.0.0.1-3000/ ← local agents (loopback)
Agent-0.0.0.0-3000/ ← remote listener (if enabled)
```
If you don't see `Agent-0.0.0.0-*` directories, enable remote agents in MT5:
**Tools → Options → Expert Advisors → Allow remote agents**
Note the port number (default: 3000).
2026-06-25 14:49:30 +07:00
## Step 2: Copy `metatester64.exe` to Linux
2026-04-18 11:41:41 +07:00
From your Mac MT5 installation:
```bash
2026-06-25 14:49:30 +07:00
MAC_MT5 = " $HOME /Library/Application Support/MetaQuotes/Terminal/XXX/ drive_c/Program Files/MetaTrader 5"
2026-04-18 11:41:41 +07:00
scp " ${ MAC_MT5 } /metatester64.exe" user@linux-server:~/mt5agents/
scp " ${ MAC_MT5 } " /*.dll user@linux-server:~/mt5agents/
```
2026-06-25 14:49:30 +07:00
## Step 3: Launch agents on Linux
2026-04-18 11:41:41 +07:00
```bash
cd ~/mt5agents/
wine64 metatester64.exe /server:192.168.1.100:3000 /agents:8
```
**To run as a background service:**
```bash
nohup wine64 metatester64.exe /server:192.168.1.100:3000 /agents:8 \
> ~/mt5agents/agents.log 2>& 1 &
disown
```
2026-06-25 14:49:30 +07:00
## Step 4: Verify agents appear in MT5
2026-04-18 11:41:41 +07:00
On your Mac, open MT5:
**View → Strategy Tester → Agents tab**
You should see entries like:
```
Agent-192.168.1.200-3000 [Active]
```
2026-06-25 14:49:30 +07:00
## Step 5: Configure MT5-Quant for remote agents
2026-04-18 11:41:41 +07:00
2026-06-25 14:49:30 +07:00
In `config/mt5-quant.yaml` :
2026-04-18 11:41:41 +07:00
```yaml
optimization :
remote_agents :
enabled : true
2026-06-25 14:49:30 +07:00
check_agent_count : true
min_agents : 4
2026-04-18 11:41:41 +07:00
```
## Tick Data Sync
2026-06-25 14:49:30 +07:00
On first run, MT5 automatically downloads ticks from the broker. Pre-populate on Linux:
2026-04-18 11:41:41 +07:00
```bash
# On Mac — find tick data location
find ~/Library/Application\ Support/MetaQuotes -name "*.bin" | grep "XAUUSD"
2026-06-25 14:49:30 +07:00
# Copy to Linux
2026-04-18 11:41:41 +07:00
scp -r " ${ TICK_DIR } " user@linux-server:~/mt5agents/ticks/
```
## Troubleshooting
**Agents connect then immediately disconnect**
- MT5 version mismatch between `metatester64.exe` (from Mac) and the master. Use the exact same build number.
**Agents show as connected but don't receive work**
- Start an optimization from the MT5 GUI first to "activate" remote agents, then cancel it and use MT5-Quant.
**Performance is slower with remote agents**
2026-06-25 14:49:30 +07:00
- Use wired connection. WiFi or WAN: significant overhead.