Discussing the article: "Connecting MQL5 to Apache Cassandra: A Native CQL Binary Protocol (v4) Client for Tick-Level Feature Archival"

Check out the new article: Connecting MQL5 to Apache Cassandra: A Native CQL Binary Protocol (v4) Client for Tick-Level Feature Archival.

This article builds a driverless MQL5 client for Cassandra's CQL binary protocol v4 using outbound TCP sockets. It explains frame headers and primitives, SASL PLAIN, prepared statements, and UNLOGGED batches, then demonstrates an EA that writes per‑tick feature vectors with batched throughput and a reconnect‑and‑retry flush path verified on a real node.

MQL5 has no built-in Cassandra driver, and MetaTrader won't load ODBC or Cassandra client DLLs in a distributable EA — the only way out is a raw outbound TCP socket (SocketCreate/SocketConnect/SocketSend/SocketRead). Cassandra's native protocol is public, so this article builds a CQL binary protocol v4 client on top of that socket — version byte fixed at 0x04, no negotiation (v4 still works against Cassandra 5; v5 isn't implemented) — and puts it to work on something a trading EA genuinely needs: writing a per-tick feature vector — bid, ask, spread, signed volume delta, a short rolling realized-volatility estimate — into Cassandra on every tick OnTick is actually called for, batched for throughput, so the resulting table can feed a feature store, an offline training pipeline, or a post-trade audit trail with no CSV file or second process in between. One caveat up front: MetaTrader 5 doesn't guarantee a distinct OnTick call for every real tick, so this is a complete record of what the terminal handed the EA, not a provable capture of the whole tick stream (more in Limitations).

Author: Bosede Gbadebo