How I Build/Custom MT5 Data Feed for Live Strategy Execution
[ Algorithmic Trading Platform ]

Custom MT5 Data Feed for Live Strategy Execution

MetaTrader 5MQL5Expert AdvisorDockerNode.jsWebSocketPostgreSQLSupabase
Custom MT5 Data Feed for Live Strategy Execution
01

Problem

Some brokers like FXCM and OANDA provide their own APIs for data feed and execution. But most CFD brokers — IC Markets, Vantage, Pepperstone — have no manager API. You cannot programmatically get price data or execute trades through a REST endpoint. Third-party data APIs like Polygon or Twelve Data give you generic aggregated prices, but those are not the prices your broker quotes. The spread, the slippage, the exact tick — they differ between brokers. If your strategy backtests on Polygon data but executes on IC Markets prices, the results will not match.

02

Approach

Built a custom MQL5 Expert Advisor that runs inside the broker's own MT5 terminal and captures every tick at the source. The EA builds OHLC candles at multiple timeframes simultaneously and pushes them via HTTP POST to a Node.js ingestion service on each candle close. This gives us the 1:1 correct price feed based on the exact broker we are operating from — not approximated data from a third party. The entire setup runs in a Dockerized headless MT5 instance on Linux using Wine, so it operates 24/5 without a desktop.

03

Outcome

Strategies execute on the same prices they were designed for. Zero discrepancy between backtest data and live execution. Eliminated the $200+/month cost of third-party data APIs and their rate limits. The feed runs autonomously with health monitoring that auto-restarts the container if the EA stops sending data.

Step by Step

01Wrote MQL5 Expert Advisor that hooks into the broker terminal and captures every tick
02EA builds OHLC candles at multiple timeframes (M1, M5, M15, H1, H4, D1) simultaneously
03Candle data pushed via HTTP POST to a Node.js ingestion endpoint on each candle close
04Ingestion service validates, deduplicates, and stores candles in Supabase (PostgreSQL)
05Dockerized headless MT5 instance with Wine so it runs on Linux servers 24/7
06Health monitoring restarts the container if the EA stops sending data
07Signal service reads from the same price feed for strategy execution decisions