Capturing Closed Trades from MQL5 and Sending Them to an API
Summary
This article describes an event-driven bridge that detects closed trades in MetaTrader 5, collects their details, formats them as JSON, and sends them to an external API over HTTP. Its Expert Advisor uses the trade-transaction event handler and filters for newly added deals whose entry type indicates an exit, including closure by an opposing position. The endpoint is configurable, so the destination can be changed through an input setting.
The article presents the bridge as a way to move finalized trade records into a backend for later storage and analysis. It reports a successful transmission test, but the backend is not yet storing or processing the received data; that work is deferred to a later installment. The approach depends on the terminal receiving trade events and the API being reachable. It focuses on data collection plumbing rather than trade selection, execution performance, or investment results.
Key ideas
- An MQL5 trade-transaction handler can respond to account trade events without polling on every tick.
- The bridge filters for newly recorded deals that represent position exits.
- Trade details are structured as JSON and sent to a configurable backend endpoint over HTTP.
- The article reports a successful receipt test, while database storage and processing remain future work.
- This is a data pipeline example rather than a trading strategy or performance study.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.