Speak the broker's wire protocol directly. No MetaTrader terminal, no Expert Advisor, no bridge process — a .NET library that logs in, streams ticks and trades on MT4 and MT5 from your own application.
The terminal-plus-EA route works, but it puts a GUI application, a chart and an EA between your strategy and the broker. The native connector removes that chain: one process, one socket per account, deterministic startup, and tick latency limited by the network — not by a terminal's message loop.
| Terminal + EA | Native connector | |
|---|---|---|
| Processes per account | Terminal + EA + app | App only |
| Startup | Terminal launch, chart, EA attach, login | Socket connect + protocol login |
| Tick path | Broker → terminal → EA → TCP → app | Broker → app |
| Headless / VPS | Needs a desktop session | Runs as a service |
| Failure surface | Terminal stalls, EA errors, chart state | Socket and session state, fully logged |
The trade server is resolved from the broker server name and connected over TCP. MT4 and MT5 share one session abstraction.
Native authentication per platform — MT5's encrypted login exchange, MT4's key-hardening handshake on modern server builds.
Symbols, groups, account state and open trades stream in after login, so the session starts consistent with the broker.
Bit-packed MT5 tick records and MT4 quote packets decode into one quote model; trade requests, results and order updates flow on the same session.
| Area | MT5 | MT4 |
|---|---|---|
| Login & session keys | Encrypted handshake, session AES | XOR-chain login, key hardening (build ≥1010) |
| Tick stream | Bit-packed tick records | Quote packets, session-key encrypted |
| Symbols & account | Symbol/group download, account state | Symbol records, account polling |
| Trading | Trade requests, results, trades pump | Order transactions, results, order updates |
| Order types | Market, limit, stop, stop-limit; FOK/IOC policies | Market, limit, stop; expiration handling with GTC fallback |
The connector powers TwoLeg's native connection route: platform, login, password and server in the Connections UI, password DPAPI-encrypted in config, fast-feed capable.
Both native sessions (MT4 and MT5), the shared resolver and limit-order layer, engine/config/UI wiring in TwoLeg, and the test suite are complete.
Live demo-account verification against real broker servers. Until that passes, the native route is flagged experimental in TwoLeg and the EA route remains the supported path.