Deploy live on Exness (MT5)¶
End-to-end: from cloning qkt to a paper trade on an Exness demo account, through the Docker stack.
Demo account only
Use an Exness demo account for this walkthrough. The qkt project is pre-1.0 and not yet recommended for live capital. Demo accounts let you verify the integration without risk.
What you'll need¶
- Docker + Docker Compose v2
- An Exness demo account (free, takes 60 seconds at exness.com)
- Your MT5 login + password + server name (Exness emails them at signup)
- ~10 minutes
1. Clone and configure¶
git clone https://github.com/elitekaycy/qkt.git
cd qkt
cp .env.example .env
cp qkt.config.yaml.example qkt.config.yaml
Edit .env with your MT5 credentials:
MT5_LOGIN=12345678
MT5_PASSWORD=your-mt5-password
MT5_SERVER=Exness-MT5Trial
VNC_PASSWORD=pickanything
EXNESS_GATEWAY_URL=http://mt5-gateway:5001
The MT5_SERVER value comes from Exness — it's usually Exness-MT5Trial for demo or Exness-MT5Real for live. Check the email Exness sent at signup.
Edit qkt.config.yaml to use the built-in Exness profile:
source: live
brokers:
exness:
type: mt5
extends: exness # inherits suffix, tz, defaults
gateway_url: ${EXNESS_GATEWAY_URL}
magic: 4242 # unique per qkt deployment; identifies your orders on restart
2. Bring up the stack¶
This starts two containers:
mt5-gateway— Wine + MT5 terminal exposing an HTTP API on port 5001qkt— the trading daemon, waits for the gateway to be healthy before starting
Verify both are running:
3. Log in to MT5 once¶
The MT5 terminal needs an interactive login the first time. Connect to it via VNC:
# Mac: brew install tigervnc-viewer ; open vnc://localhost:3000
# Linux: any VNC client → localhost:3000
# Windows: TightVNC, RealVNC, or RDP-style tools
Use the VNC_PASSWORD you set in .env.
Inside the MT5 GUI:
- File → Login to Trade Account
- Enter your login, password, and server name
- Click "Login"
You should see your balance + a green "connected" indicator at the bottom-right of MT5.
Verify from the host:
curl http://localhost:5001/health
# {"ok": true, "account": {"login": 12345678, "balance": 10000.00, ...}}
If ok: false, the login didn't take — back into the VNC GUI.
4. Audit the tick feed first¶
Before deploying a real strategy, verify the gateway's ticks match what you expect. The audit-ticks CLI captures live ticks for a few minutes and reports any anomalies:
Output:
audit-ticks EURUSD via exness
ticks received: 312
bid range: 1.0828–1.0834
ask range: 1.0829–1.0835
spread (avg): 1.2 points
spread (max): 3.4 points
duplicates: 0
out-of-order: 0
gaps > 5s: 0
If you see large gaps or out-of-order ticks, that's a feed quality problem — investigate before deploying.
5. Write a paper strategy¶
Put it in ./strategies/ (mounted into the container at /strategies):
STRATEGY eur_paper VERSION 1
SYMBOLS
eur = EXNESS:EURUSD EVERY 5m
RULES
WHEN ema(eur.close, 9) CROSSES ABOVE ema(eur.close, 21)
THEN BUY eur SIZING 0.01
BRACKET { STOP_LOSS BY 30 PCT, TAKE_PROFIT BY 60 PCT }
LOG "long entry" price=eur.close
Note: SIZING 0.01 is 0.01 lots — the minimum on most MT5 accounts, ~$1000 notional on EURUSD.
6. Deploy it¶
Output:
Verify it's running:
7. Watch it work¶
Tail the logs:
You'll see ticks arrive + condition evaluations. When the EMA crosses, you'll see a BUY action and a broker submission. The fill comes back as a TradeEvent a few hundred ms later.
Check the position from the host:
Also visible inside MT5 (via VNC) — the position appears in the "Trade" tab with the magic number 4242.
8. Stop cleanly¶
--flatten closes any open position at market before stopping. Without it, the position stays open.
To tear down the whole stack:
Going to a different MT5 broker¶
Same pattern, different profile:
brokers:
icmarkets:
type: mt5
extends: icmarkets # built-in
gateway_url: http://icmarkets-gateway:5001
magic: 4243
ftmo:
type: mt5
extends: ftmo # built-in
gateway_url: http://ftmo-gateway:5001
magic: 4244
Then in the strategy: eur = ICMARKETS:EURUSD EVERY 5m. Each broker gets its own gateway container — they don't share. Add them to docker-compose.yml with the same shape as mt5-gateway.
Common gotchas¶
- MT5 logs you out periodically. Some brokers force re-auth daily. VNC back in and log in again. Add a healthcheck alert if you care.
- Exness symbol suffix. Exness adds
m(EURUSDm, GBPUSDm, etc). The built-inexnessprofile handles this — but if youextends:a different base and overridesymbolPolicy, double-check the suffix. - Magic number collision. If you run multiple qkt instances against the same MT5 account, give them different
magicnumbers. State recovery uses magic to identify "its own" positions. - Gateway image not on Docker Hub. Build it locally from github.com/elitekaycy/mt5-gateway or pull from your private registry.
See also¶
- Deploy with Docker — operations-level reference
- Config schema — full
qkt.config.yamlfields - Broker integration — capability matrix and per-broker quirks
- Phase 17 — MT5 broker — the gateway protocol + profile internals