Skip to content

MetaTrader 5 integration

Cortiq’s only execution path is MetaTrader 5 on the same Windows machine. This page explains how that connection works, what to configure before you trade live, and how to scale it across multiple accounts without a port collision.

Cortiq runs as a local Windows desktop app and reaches MetaTrader 5 over a ZeroMQ bridge on localhost. It’s a tightly coupled pair: Cortiq sends commands and receives streaming data through ZmqFacade, an Expert Advisor that lives inside your MT5 terminal.

This is not a generic broker connector. Cortiq does not support MT4, web brokers, or proprietary APIs. If your broker offers MT5, you can run Cortiq against it; if it doesn’t, Cortiq isn’t the right tool.

The integration handles every market interaction the platform needs: live pricing, account state, order placement and modification, position management, and connection health.

flowchart LR
  C[Cortiq desktop app<br/>C#] -- ZeroMQ REQ/REP<br/>command port --> Z(ZmqFacade EA<br/>MQL5)
  C -- ZeroMQ SUB<br/>data port --> Z
  Z --> M[(MetaTrader 5<br/>terminal)]

Cortiq talks to each MT5 terminal through a small Expert Advisor (ZmqFacade) over two ZeroMQ ports — one for synchronous commands, one for streaming data.

AreaCortiq’s role
Market dataReads candles, ticks, and indicator values from the connected terminal.
Account contextReads balance, equity, margin level, and symbol properties on every cycle.
Order flowPlaces market and pending orders when a session is allowed to execute.
Position managementModifies stop-loss / take-profit, performs partial and full closes, runs trailing logic.
MonitoringTracks bridge health and pauses sessions cleanly on disconnect or risk events.

The setup has three parts: install the EA in your terminal, configure the account in Cortiq, and verify the bridge is healthy before starting a session.

Open SettingsMT5 Accounts and add an entry. You’ll need the terminal’s executable path, the data folder, and a unique pair of ZeroMQ ports.

Cortiq Settings → MT5 Accounts panel

Open MetaTrader 5 and drop ZmqFacade.ex5 onto any chart with automated trading enabled. The EA also needs the MQL5 ZeroMQ library installed under MT5’s Include/Zmq/ folder. The EA’s smiley face icon appears in the top-right of the chart when it’s running.

ZmqFacade EA attached to a blank EURUSD chart

Cortiq’s topbar shows an MT5 health indicator. Green means the bridge is connected and recent heartbeats arrived on time; red means the EA isn’t responding. Don’t start a session until the indicator is green.

Cortiq topbar showing MT5 health indicator in green/connected state

Cortiq supports multiple MT5 accounts on the same machine, but each terminal must run on a non-overlapping pair of ZeroMQ ports.

Example pattern (the EA defaults are command port 6200, data port 6201):

  • Account 1 — command port 6200, data port 6201.
  • Account 2 — command port 6202, data port 6203.
  • Account 3 — command port 6204, data port 6205.

The exact numbers don’t matter — non-overlap does. Two terminals on the same port will collide silently and one of them will appear to “work intermittently”.

SettingWhereNotes
Terminal pathSettingsMT5 AccountsTerminal executableFull path to terminal64.exe.
Data folderSettingsMT5 AccountsData folderWhere Cortiq writes the EA companion files.
Command portSettingsMT5 AccountsZMQ command portREQ/REP. Default 6200. Must be unique across accounts.
Data portSettingsMT5 AccountsZMQ data portPUB/SUB. Default 6201. Must be unique across accounts.
Default accountSettingsMT5 AccountsDefaultThe account that new sessions and trade ideas pre-select.

Is MT4 supported? No. Only MT5. Brokers that offer both will work as long as you connect through their MT5 build.

Can I run a remote MT5 terminal? No. Cortiq and MT5 must be on the same Windows machine. The bridge uses localhost ZeroMQ and assumes both processes share the same OS.

What happens if MT5 disconnects mid-session? The session pauses on the next health-check failure. No new orders are placed; open positions remain managed by MT5 itself until the bridge recovers and Cortiq re-attaches.

  1. First 30 minutes in Cortiq — installs the EA and runs a virtual session end-to-end.
  2. Sessions — once the bridge is green, this is where you build the session that uses it.
  3. Risk management — configure global and per-account limits before any live execution.