Open Trading Metatrader 4 Python Integration
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is even with OpenTrading:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


OTMql4Py - Open Trading Metaquotes4 Python Bridge

This project provides that ability to run a complete Python interpreter under Metatrader4. Mt4 can make calls into Python, using any of Python's commands or imported modules. When coupled with the OTLibProcessCmd.mq4 ( capabilities of the libraries, Mt4 can poll Python for commands to be executed in Mt4 from Python.

This project is based in work by Bernd Kreuss: with contributions by C. Polymeris:

This is a work in progress - a developers' version.

The code is quite stable now, and there should be no major file or API changes. Only Python 2.7.x is supported.

There is now an installer in the Releases section on see If you are on a 64bit machine, we use 32bit installs even on 64bit machines, because Metatrader in a 32bit application; see


The source code to generate the py27.dll are in the src directory.

The sources have minor fixes to the original code other than the py26 -> py27 syntactic conversion. The dll checked-in has been recompiled against the current source using MS VC 2010 Express.


Please file any bugs in the issues tracker:

Use the Wiki to start topics for discussion: It's better to use the wiki for knowledge capture, and then we can pull the important pages back into the documentation in the share/doc directory. You will need to be signed into to edit in the wiki.

Please report any system it works or doesn't work on in the wiki: include the Metatrader build number, the origin of the metatrader exe, the Windows version, and the Python version and origin of the Python. This code is known to run under Linux Wine (>= 1.7.x), so this project bridges Metatrader to Python under Linux.

If you know of any threads in the forums that discuss this code, please post a message to say this project is now on at

For the project documentation, see the Wiki: