[Technical Report] MT4×Python Direct Connection Pipeline Opening: ZeroMQ Integration and Acceptance of Physical Latency
■ Introduction: Why Return to the Old-Generation Architecture Now
We, Semura Lab, have always pursued the most optimal and fastest execution environment in process design to extract expectations from market data. Already on modern platforms such as MT5 or cTrader, we have implemented a “slipless-drive” that directly connects the Python (brain) computation results to the platform (execution) with no delay or noise by utilizing the official API.
From an engineering perspective, there is little rationality in adopting MT4, a relic of 32-bit architecture. However, when viewed from a process design engineer’s vantage point over the entire system, we confronted one structural challenge. The vast historical data we have accumulated for years and the validation framework of Walk Forward Analysis (WFA) are deeply dependent on MT4’s data structure.
Simply changing platforms to seek surface-level speed would destroy continuity with past data and become fertile ground for curve fitting (over-optimization). What we need now is not just order execution speed but a robust foundation for verification that can forward-test under conditions indistinguishable from past validation data. To build this verification foundation, we strategically decided to venture into the abyss of the legacy MT4 system.
■ 1. Elimination of Illusion: Abandoning “Fully Slipless” and Adopting ZMQ
MT4 does not have a native Python integration module like MT5. The only architectural solution to inject external computation logic is to build local socket communication using ZeroMQ (ZMQ).
Here we must accept the cold hard fact of physical constraints. Since an external communication socket via ZMQ is involved, achieving the “fully slipless” environment realized in MT5 is physically impossible. Inter-process communication will inevitably incur a few milliseconds of latency. However, process design is about finding the optimal solution within constraints. Even if some delay is allowed, we must integrate Python’s advanced computational capability with MT4’s historical data; otherwise, the system’s evolution will stall. We discard the illusion and accept this physical boundary.