MetaTrader 4 MT4 Libraries ZeroMQ asynchronous communication – library MetaTrader 4

ZeroMQ asynchronous communication – library MetaTrader 4


These are partial bindings to the zeromq library along with a demo of a zeromq tcp socket. If anyone makes more complete bindings please share! I might if i need all of the features. Linux wine version also included.


Ø  The socket library that acts as a concurrency framework.

Ø  Carries messages across inproc, IPC, TCP, and multicast.

Ø  Connect N-to-N via fanout, pubsub, pipeline, request-reply.

Ø  Fast enough for clustered products and supercomputing.

Ø  Asynch I/O for scalable multicore message-passing apps.

Ø  Large and active open source community.

Ø  20+ languages including C, C++, Java, .NET, Python.

Ø  Most OSes including Linux, Windows, OS X.

Ø  LGPL free software with full commercial support.”

And its very simple to use. Notice that you cant automatically connect to a raw socket, we’re connecting zeromq to zeromq here. Though i think there is support for adding raw sockets into a network using zeromq_poll, though i haven’t bound that yet.

VERSION 2: precompiled libs for windows and linux x86 32 bit added (using zeromq version 2.0.10). Added cmake build script for windows. Updated zeromq script so that it uses port, instead of ‘localhost’ which doesnt work. And most importantly fixed a shared memory bug between mql4 and zeromq library – basically we now copy strings sent to our wrapper library and copy new strings when we request data from a message. Note that there is no check if malloc returns null in sample code, maybe that should also be included for rare cases when not enough memory is available? So we dont crash metatrader by trying to pass in a null pointer? I’ll test this soon..

Alternative:   risk - EA MetaTrader 5

VERSION 3: pub/sub, multipart send (no receive), polling on one socket, no more using of raw messages (automatically created/deleted). Added commando and pub/sub example, updated other example. NOTE: i dont know how to safely destroy a poll object, i tried free(ptr) and metatrader crashes. if anyone can help here….

VERSION 3.2: added multi part receive (through z_more), added sending of double arrays and int arrays, refactored commando example (and demonstrate array sending). changed window dlls to release. added linux

VERSION 3.3: updated commando example to include multipart receive. And also majorly changed it to make more efficient. Also included GUI.mqh

UPDATE : modified to include an executable (commando.exe) that will install the newest version of libzmq and bindings and sample commando program along with a python interface. This might be a quick fix for problems mentioned below. So just run commando.exe….

📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks