All work
Trading Automation

Terminal-less MT5 Bridge: Webhooks to Orders Over the Broker Protocol

One Python process that speaks the MetaTrader 5 protocol directly, replacing a Windows host, terminal and EA per account.

Measured 53 MB per account versus 121 to 202 MB plus a Windows VM, logs in in seconds instead of minutes, templated systemd instances bound to loopback, idempotent setup and verify scripts, and two parser defects flagged rather than hidden.

Terminal-less MT5 Bridge: Webhooks to Orders Over the Broker Protocol — illustration
What makes it serious
  • 53 MB per account vs 121-202 MB plus a Windows host
  • Seconds to log in instead of ~5 minutes
  • Templated loopback-bound instances with idempotent setup and verify
  • Parser defects documented, not hidden

The terminal-based execution engine behind a broker-automation product needed a Windows VM, pool nodes, WinRM, scheduled tasks and CSV heartbeats, and the Windows host was the expensive half of the bill. This bridge removes all of it: a single Python service accepts webhooks and talks the MT5 broker protocol directly, with no terminal and no EA. Measured resident memory was 53 MB per account, and login takes seconds rather than the five-plus minutes a cold pool node needed.

On the production host it ran as templated systemd instances, one per account, bound to loopback behind the existing Apache so it could never fight the live site for ports. The setup script is idempotent and doubles as the update path; a verify script proves the instance works and that the site, engine and Apache were undisturbed. A real order on a demo account confirmed the path.

Two defects in the protocol parser were found and deliberately flagged rather than papered over: account equity and margin fields are wrong, and position profit is unscaled by a large factor, so risk logic must use balance or deal history. The open licence question on the vendored client library was recorded in a NOTICE file.

Executes broker orders; shared as engineering work, not financial advice.

How it works

  1. Webhook arrives at the loopback-bound instance for one account
  2. Service authenticates to the broker over the MT5 protocol
  3. Order is placed and the response returned to the caller
  4. History endpoint provides trustworthy P&L for reporting
  5. Setup and verify scripts handle deploy and health
Stack
PythonsystemdApacheMetaTrader 5 protocolGCP

Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.

#mt5#bridge#webhooks#systemd#python#infrastructure