Skip to content

ch4r10t33r/mql4zmq

 
 

Repository files navigation

OTMql4Zmq - MQL4 bindings for http://zeromq.org, the high-speed messaging protocol for asynchronous communications between applications.

https://github.com/OpenTrading/mql4zmq/

This is a fork of the pre-2.0.0 branch of: https://github.com/AustenConrad/mql4zmq/

It is being updated Mt4 > Build 600 to generate the DLLs for: https://github.com/OpenTrading/OTMql4Zmq/

We plan on upgrading it to ZeroMQ 4.x and have started that process, but for now the version 4.0.4 code is not completely working. We are integrating in the changes from https://github.com/ungratefulson/mql4zmq/ -b MQ_610_ZMQ_4 but they are only a partial upgrade to ZeroMQ 4.x. We may make a v4.0.4 git branch to pull in the changes.

We want to make sure that all of the current 2.2.0 version works first, and we want a test suite in place before we do. There is no reason that this code should not upgrade easily, but as ZeroMQ is backwards compatible with version 2.2.0, there is no immediate need to upgrade.

As of now the code is working fine, and the DLLs are being used by: https://github.com/OpenTrading/OTMql4Zmq which is being used by https://github.com/OpenTrading/OpenTrader

Note that we use a different include header file OTMql4Zmq.mqh which has a lot of changes from the legacy mql4zmq.mqh, and these changes can be very important.

Version Notes

This code is for MetaTrader build >600. If you are using MetaTrader build 509 or earlier, use https://github.com/AustenConrad/mql4zmq/releases/tag/v1.0.1

We are staying with Microsoft Visual C++ Express 2010 as the compiler to keep the project build instructions the same as Austen Conrad's. We will aim to support Windows XP SP3 and better. You will need to have the Microsoft Visual C++ 2010 Redistributable Package (see below) to run this, but pratically all Windows computers will already have this installed. Later, we will try compiling it with http://mingw.sourceforge.net, as ZeroMQ supports that compiler. and there should be no problems.

We have checked in the results of building from source (see below) in the https://github.com/OpenTrading/mql4zmq/raw/master/pre-compiled directory.

Original Readme

The goal of this project is to provide http://docs.mql4.com/ bindings for the http://zeromq.org/ networking library.

Licensed under the MIT License. See https://github.com/OpenTrading/mql4zmq/blob/master/LICENSE for more information.

Example Usage

See Publish/Subscribe example in the https://github.com/OpenTrading/mql4zmq/tree/master/examples folder. In general the use is exactly as http://api.zeromq.org/2-1:_start in the ZeroMQ API Documentation by http://zeromq.org, and described in the "C" examples in the [ZGuide|http://zguide2.zeromq.org/page:all]] ZeroMQ ZGuide.

To Build From Source

If you just want the compiled libraries to use in Mt4, skip down to the next section To use the pre-compiled libraries.

0. Download and install http://go.microsoft.com/?linkid=9709949 if you don't already have it. You may need help in http://stackoverflow.com/questions/4422745/how-do-i-get-the-serial-key-for-visual-studio-express.

1. Download and untar the ZeroMQ v2.2.0 source: http://download.zeromq.org/zeromq-2.2.0.tar.gz

2. Git clone the [MQL4ZMQ source|https://github.com/OpenTrading/mql4zmq/]] code

git clone --depth=1 https://github.com/OpenTrading/mql4zmq

to create the mql4zmq directory.

3. Copy the downloaded mql4zmq source folder to be a sub-directory of: zeromq-2.2.0\builds\msvc\

4. Open the ZMQ build solution in zeromq-2.2.0\builds\msvc. At the moment we are only testing with Microsoft Visual C++ 2010 Express, and plan to support Windows XP SP3 or better.

  • You may need to right click on it and select: "open with" => "Microsoft Visual C++ 2010 Express"
  • It may need to be converted. In which case, select next => no then next => finish

5. Now that we have the solution open we need to add the mqlzmq project to the solution. To do this:

1. Right-click on Solution libzmq then select "add" => Existing Project

2. A file browser opens up. Go into the msvc folder then the mql4zmq folder and select the mql4zmq.vcxproj project file. You should now see the mql4zmq listed as project within the solution.

3. Right-click on the mql4zmq project and select Project Dependencies. Make sure the drop-down Projects menu is set to mql4zmq, and then select libzmq in the Depends on list. Select OK to complete.

4. Make sure the build is set to Release and not Debug. Look for drop-down in middle of top Visual C++ application toolbar.

5. You are now ready to build the solution which will produce the ZeroMQ library libzmq.dll and the MQL4ZMQ bindings library (mql4zmq.dll). To do this right-click on the solution and select Build Solution.

Installing the Build From Source

Once all 8 projects within the solution have completed building, we need to copy the files the MetaTrader needs to the location it needs them as follows.

Make the following 3 directories if they don't aleady exist:

  • c:\Program Files\[metatrader directory]\MQL4\Experts\OTMql4
  • c:\Program Files\[metatrader directory]\MQL4\Include\OTMql4
  • c:\Program Files\[metatrader directory]\MQL4\Libraries\OTMql4

This will help make this project compatible with other OpenTrader projects, and will simplify the release-packaging later. Also by giving files different names from Austen Conrad, we help avoid collisions in case someone has both projects.

zeromq-2.2.0\builds\msvc\Release\mql4zmq.dll
=> c:\Program Files\[metatrader directory]\MQL4\Libraries\OTMql4\mql4zmq.dll

zeromq-2.2.0\lib\libzmq.dll
=> c:\Windows\SysWOW64\libzmq.dll or
=> c:\Windows\System32\libzmq.dll or
whatever the windows system library is for your version of Windows.

zeromq-2.2.0\builds\msvc\mql4zmq\OTMql4Zmq.mqh
=> c:\Program Files\[metatrader directory]\MQL4\Include\OTMql4\OTMql4Zmq.mqh	

zeromq-2.2.0\builds\msvc\mql4zmq\examples\mql4zmq.mq4 
=> c:\Program Files\[metatrader directory]\MQL4\Experts\OTMql4\mql4zmq.mq4

6. You are now ready to open up Metatrader, attach the example mql4zmq expert to the chart, and be off and running.

NOTE: when attaching to the chart make sure to select "Allow DLL Imports" and de-select "Confirm DLL Function Calls".

To Use The Pre-Compiled Libraries

0. In the unlikely event your windows does not have a copy of the file msvcr100.dll in your windows system directory, download and install the http://www.microsoft.com/download/en/details.aspx?id=5555.

1. git clone the https://github.com/OpenTrading/mql4zmq/ mql4zmq github code.

2. Copy the following files to the following locations for MetaTrader:

mql4zmq\pre-compiled\mql4zmq.dll 
=> c:\Program Files\[metatrader directory]\MQL4\Libraries\OTMql4\mql4zmq.dll

mql4zmq\pre-compiled\libzmq.dll 
=> c:\Windows\SysWOW64\libzmq.dll or
=> c:\Windows\System32\libzmq.dll or
whatever the windows system directory is for your version of Windows.

mql4zmq\OTMql4Zmq.mqh 
=> c:\Program Files\[metatrader directory]\MQL4\Include\OTMql4\OTMql4Zmq.mqh

mql4zmq\examples\mql4zmq.mq4 
=> c:\Program Files\[metatrader directory]\MQL4\Experts\OTMql4\mql4zmq.mq4

3. You are now ready to open up Metatrader, attach the example ml4zmq expert to the chart, and be off and running.

NOTE: when attaching to the chart make sure to select "Allow DLL Imports" and de-select "Confirm DLL Function Calls".

Project

Please file any bugs in the issue tracker: https://github.com/OpenTrading/mql4zmq/issues

Use the Wiki to start topics for discussion: https://github.com/OpenTrading/mql4zmq/wiki/ It's good to use the wiki for knowledge capture, and then we can pull the important pages back into the documentation in the wiki directory. You may need to be signed into github.com to see or edit in the wiki.

About

MQL4 bindings for ZeroMQ

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 100.0%