Download MetaTrader 5
To add comments, please log in or register
The entire history on a single page!
ejjcb1 2015.05.28 04:42 


Is it possible to run a algorithm written in Python on MT4? 



whroeder1 2015.05.28 12:00  
ejjcb1: Is it possible to run a algorithm written in Python on MT4?
  1. Hard:You write MT4 code to interface with a DLL. You write the DLL to communicate with Python. You write Python.
  2. Simple: Just learn to code MT4.
JD4 2015.06.25 01:22  
Would this still be the case if the algorithm was already written in Python, and they wanted to use an existing program as this situation was spelled out?  Especially if they do not have access to the specifics of the algorithm.  Just wondering.
ydrol 2015.06.25 07:25  

There is a python dll but appears unsupported for last 5 years ?

If going this route I would also consider named pipes for a more generic interface. (receive quotes / send orders / history-series? ) - if using named pipes I'd also conside running MT4 under Wine/Linux as named pipes in Linux are very 'clean' and more like an afterthough in Windows - of course changing platform is significant risk otherwise  :) )

If the algorithm is 'relatively simple' then I would migrate to MQL4.

If the algorithm is 'relatively complex' and involves connecting to external sources, multiple threads, and uses lots of supporting libraries (unzipping, json, XML etc),  then re-implementing and debugging in MQL4 might be more effort than implementing named pipes to receive quotes and send orders,

as languages like python have a) more complete support libraries and b)are more advanced having 4GL capabilities allowing for better expression of algorithms working on datasets. 

Conversely MQL is the right tool for receiving quotes and sending orders :) and especially if you want to draw and interact with objects on charts. And is better now it supports OOP. That's a decision to be made by the developer after weighing up pros and cons :)

To really leverage OOP, MQL4 community needs a ground-swell of reliable , tested supported maintained support libraries. (associative arrays, zip, gzip, RSS, XML etc). DLL help here certainly. A 'collaborative '  Code-Base 'model' would really help here rather than the current model where a library is published by one person  who disappears after 5 years, and bug fixes are in comments section :)

To add comments, please log in or register