Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2010.11.22 09:35

ZeroMQ asynchronous communication - library for MetaTrader 4

| English Español Português 日本語 Deutsch

votes: 10 (525.39 KB)
zmq.mq4 (1.42 KB)view (713.74 KB)


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..

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....

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

Example of MACD Automated Example of MACD Automated

Code example of MACD automated with advanced money management function.

Pivot Star Pivot Star

Pivot indicator. Standard, Fibonacci, Camarilla, Woody's, Demark. Calculates pivot points from previous bar of chosen period (M5 - MN).