Installation And Setup Of ZeroMQ, MetaTrader 4, Python IDE On Windows 10 Configuration Instructions

configuration_instructions

configuration_instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 13

Installation and Setup of ZeroMQ, MetaTrader 4,
Python and IDE on Windows 10
Ruslan Masinjila
October 23, 2018
Requirements
IWindows 10
IPython 2.7
Ipyzmq (Python binding for ZeroMQ)
IPython IDE
IMetaTrader 4
Installation of Python 2.7
Easiest way to install and configure Python is through Anaconda.
IVisit Anaconda (https://www.anaconda.com/download/)
IDownload Anaconda installer for 32-bit Python 2.7 1and
place it on Desktop
ICreate a folder inside the Cdirectory called Anaconda. This is
where installed files will be placed.
IRun the downloaded installation file and follow instructions.
For the destination folder, select the folder you just created
using the browse button. Once selected, the destination path
should look like C:\Anaconda\. Click next and proceed with
the installation.
IAt the end of installation, click on Install Microsoft VSCode
(recommended).
132-bit is required for compatibility with pyzmq
Configuration of Python 2.7
After installation of Python 2.7 through Anaconda, open cmd
prompt (Search for cmd from bottom left, near windows icon).
Within the terminal, type python followed by Enter.
Most likely, ”python” is not recognized... will be displayed. In
order to fix this, a path to python has to be set as follows:
IClick on search icon near bottom left
IType Environment in the search filed. Then select Edit the
System Environment Variable
IIn the window that pops up, click on Environment Variables....
ISelect Path under System Variables and click on Edit...
IIn the next window that pops up, click on New and paste the
address of Anaconda, i.e. C:\Anaconda\.
IClick OK in all open windows. Open a new cmd promt and
type python. This time it should display python’s version and
console.
Installation of pyzmq
Pyzmq (https://pyzmq.readthedocs.io/en/latest/)
provides python bindings for ZeroMQ (http://zeromq.org/)
To install pyzmq, first add the path of pip to system variables as
explained earlier. Pip is inside the Scripts folder of the Anaconda
folder, i.e. C:\Anaconda\Scripts. Thereafter:
IOpen cmd terminal and type pip. If environment is configured
properly, the terminal should display list of available
commands for pip.
IType python -m pip install –upgrade pip in the terminal and
press Enter to upgrade pip.
IType pip install pyzmq in the terminal and press Enter to
install pyzmq.
IType python in the terminal and press Enter to open python
console. Then type import zmq and press Enter.
Type print zmq.pyzmq version() and press Enter. If no errors
occur, the version of pyzmq will be displayed on the terminal.
Installation of Python IDE
Any Python IDE can be used. The following are instructions to
install and configure PyDev in Eclipse IDE.
IIf Java Runtime Environment (JRE) is not installed on the
machine, download JRE from
(https://www.java.com/en/download/)
IInstall the JRE using default settings.
IDownload Eclipse IDE from
(https://www.eclipse.org/downloads/)
IInstall Eclipse IDE for Java Developers with the default
settings
IOnce Eclipse IDE is installed, launch the IDE using default
settings.
IInstall PyDev for Eclipse IDE using instructions from here
(https://bit.ly/2yRroHU). When prompted, choose Install
Anyway, then Restart Now Eclipse IDE.
Testing IDE with Python and ZeroMQ [1/2]
The following are steps to test PyDev and ZeroMQ in Eclipse IDE
IOn Eclipse IDE, click FileNewProjectPyDev
PyDev Project
IFor the Project name write ZEROMQ
IClick on Please configure an interpreter before proceeding if
the python interpreter is not configured in eclipse.
IClick on Quick Auto-Config in the pop-up window and click
Next for configuration to complete.
IClick Finish followed by Open perspective
IPython Project is now created. Use zeromq server.py available
at https://bit.ly/2Ja0Ztv and zeromq client.py available
at https://bit.ly/2CwfO8t to test ”Hello Wolrd” via
pyzmq. First run the server, then run the client.
Testing IDE with Python and ZeroMQ [2/2]
This is the most important step for the integration of
ZEROMQ/pyzmq with PyDev
IIn the previous slide, you are likely to get an error
(Unidentified variable from import...) after copy-pasting the
zeromq server.py and zeromq client.py to the project
(ZEROMQ)
ITo fix this error, Go to
WindowsPreferencesPyDevInterpretersPython
Interpreter
IClick on Forced Builtins
IClick on New
IType zmq
IClick on Apply
IClick on Apply and Close
IRestart Eclipse. All Errors should be gone. Run
zeromq server.py then zeromq client.py. The server terminal
should print Hello and the client terminal should print World.
Installation of MetaTrader 4
Lon into your favourite broker, in this case darwinex
(https://www.darwinex.com/) and download MetaTrader 4
(MT 4), which is 32-bit.
IInstall MT4 and Log in with your Credentials.
IIMPORTANT: To enable execution of DLLs, Click on
ToolsOptions. Then click on Expert Advisors and check
Allow DLL imports (potentially dangerous, enable only for
trusted applications). Then click OK.
Adding mql-zmq bindings to MetaTrader 4 [1/2]
Log into your favourite broker, in this case darwinex
(https://www.darwinex.com/) and download MetaTrader 4
(MT 4), which is 32-bit.
IBefore proceeding, make sure that hidden folders in Windows
are visible. To make them visible, type folders in the bottom
left Search field next to the Windows icon. Then click on File
Explorer Options followed by View in the pop-up window.
Check Show hidden files, folders, and drives. Then click OK.
IInstalled MetaTrader 4 files can then be found in
C:\Users\user name\AppData\Roaming\MetaQuotes\Terminal\
3B534B10135CFEDF8CD1AAB8BD994B13
Adding mql-zmq bindings to MetaTrader 4 [2/2]
INow copy or download mql-zmq bindings for MQL language
from https://github.com/dingmaotu/mql-zmq and
extract the files.
IOpen the extracted folder, and copy the contents of the
Include folder into
C:\Users\¡user name¿\AppData\Roaming\MetaQuotes\Terminal\
3B534B10135CFEDF8CD1AAB8BD994B13\MQL4\Include
ICopy the contents of the Scripts folder into
C:\Users\user name\AppData\Roaming\MetaQuotes\Terminal\
3B534B10135CFEDF8CD1AAB8BD994B13\MQL4 \Scripts
ICopy the contents of Library\MT4 into
C:\Users\user name\AppData\Roaming\MetaQuotes\Terminal\
3B534B10135CFEDF8CD1AAB8BD994B13\MQL4\Libraries
Testing ZEROMQ with MetaTrader 4 and Python
IClone or Download tools and templates from DarwinexLabs
(https://github.com/darwinex/DarwinexLabs) then
extract the folder.
ICopy the contents of tools\MQL4 into
C:\Users\user name\AppData\Roaming\MetaQuotes\Terminal\
3B534B10135CFEDF8CD1AAB8BD994B13\MQL4\Experts
Testing Entire Setup
ICopy the contents of tools\MQL4 into
C:\Users\user name\AppData\Roaming\MetaQuotes\Terminal\
3B534B10135CFEDF8CD1AAB8BD994B13\MQL4\Experts.
INow open Eclipse IDE and create a python file called
zeromq test.py within ZEROMQ project reated earlier.
ICopy the contents of the file in
tools\Python\ZeroMQ MT4 Python Template.py into
zeromq test.py file you just created.
IWithin MT4, drag-and-drop ZeroMQ MT4 Python Template
into an open chart.
IWithin Eclipse, run zeromq test.py.
IIf everyting goes well, then within terminas of both Eclipse
and MT4 you should see outputs about EUR/USD.

Navigation menu