Building a Typed Named-Pipe Bus for Coordinating MQL5 Expert Advisors
Summary
The article describes a local communication system for multiple MetaTrader 5 Expert Advisors. A broker EA hosts a named pipe, receives typed messages from slave EAs, records sender state, aggregates risk, and displays sender activity on a dashboard. The proposed message schema includes a message type, sender identifier, fixed-width symbol, payload fields, sequence number, and timestamp, with serialization into a fixed-size byte layout.
The implementation discusses Windows pipe calls through MQL5 imports, message framing, a non-blocking connection poll to keep the broker responsive when no client is available, and registry and aggregation components. A verification script is described for serialization, registry, and aggregation behavior before use with a live pipe. The design is limited to one machine, does not provide broker-side reconnection, and requires all participants to share the same schema. It presents an implementation pattern, not evidence of improved trading performance or a complete general-purpose messaging system.
Key ideas
- Typed messages provide a clearer shared schema than loosely named global variables.
- The broker EA centralizes message handling, sender state, risk aggregation, and status display.
- Fixed-size serialization uses explicit field layouts and preserves the double payload as raw bytes.
- A non-blocking connection attempt prevents an idle broker timer from waiting indefinitely for a client.
- The described bus is local to one machine and lacks broker-side reconnection.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.