EA on python

 

Hi

I´m doing an EA on Python from 0 using the Metatrader5 Library so i can call the functions from there.

Until the moment I could login with specifict username and pass and also select a symbol ("EURUSD") but I´m not being able to open a position so this makes me ask myself 2 questions. Is the integration of Metatrader5 able to let me make a complet EA so everything operates from python or do I need to do everything on MQL5 programmation language and python is just for showing information?. And the second question is: if I can do the EA directly on python how do I make a trade position of buy? because I´ve been trying for too long with diferent functions but I haven´t been able to do so.

Some of the functions I´ve used for openin a position are; Buy and Trade_Action_Pending


If someone could help me that would be great.


Thanks btw!!!

 
J3SVSP:

Is the integration of Metatrader5 able to let me make a complet EA so everything operates from python or do I need to do everything on MQL5...?

If you already know python, getting familiar with MQL can't be difficult. I knew MQL then python, but I still respect the strengths of MQL, including it's C++-like speeds. The language won't make your trades more profitable of the system doesn't work even in MQL. Currently, I have python control program that manages my accounts and EA performance, and a WebApp that displays my EA charts. I also analyse my strategies with it, but creating a complete EA from it is inefficient for me, since native vps doesn't support it, neither does the Mql Market.
Are you willing to install Python on every vps you wish to run an EA on? What's the advantage compared to existing methods?
 

Nelson Wanyama:

 I also analyse my strategies with it, but creating a complete EA from it is inefficient for me, since native vps doesn't support it, neither does the Mql Market.
Are you willing to install Python on every vps you wish to run an EA on? What's the advantage compared to existing methods?

Okey, so you say that I need to rent an specific vps for every asset I want to trade with or is it just for every EA? Cause if that´s the case I prefer to make the code on MQL language. In the case it is for every EA, I´m planning to make this one function first. The advantage that I see of using python language is just because I know it is better than any other language for its simplicity and that you can write the code in less lines to make it more efficient. But it would be great to have your opinion seeing that you already have your robots in both languages.

Either way in case I decide to make it on python, Is it for sure I´m not gonna be able to make the vps work with the EA?

Because to my understanding the vps just makes the connection, what are the problems between making it on python or MQL?

I knew I needed to pay for the platform of MQL5 but not that also it works better with a vps, I´ll consider it.

Thanks, all this info works perfectly for me!

 
J3SVSP:

Okey, so you say that I need to rent an specific vps for every asset I want to trade with or is it just for every EA? Cause if that´s the case I prefer to make the code on MQL language. In the case it is for every EA, I´m planning to make this one function first. The advantage that I see of using python language is just because I know it is better than any other language for its simplicity and that you can write the code in less lines to make it more efficient. But it would be great to have your opinion seeing that you already have your robots in both languages.

Either way in case I decide to make it on python, Is it for sure I´m not gonna be able to make the vps work with the EA?

Because to my understanding the vps just makes the connection, what are the problems between making it on python or MQL?

I knew I needed to pay for the platform of MQL5 but not that also it works better with a vps, I´ll consider it.

Thanks, all this info works perfectly for me!

You do not need a VPS. You do need to ensure that your order requests are formatted correctly and use the correct type for each param, and when orders do fail you need to check the value of last_error. The python request mirrors the MQL request so you can reference the MT5 order request docs for more information. Finally, if you have a specific question then you need to post your code. 

https://www.mql5.com/en/docs/constants/structures/mqltraderequest

Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure
Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure
  • www.mql5.com
Interaction between the client terminal and a trade server for executing the order placing operation is performed by using trade requests. The trade request is represented by the special predefined structure of MqlTradeRequest type, which contain all the fields necessary to perform trade deals. The request processing result is represented by...
 
Try TradePython, you can write EA in python on it.
 

I built a library that reduces the boilerplate code for MQL5-Python integration. Some examples are already working. You just need to run it.


If something went wrong, send me a message.


https://github.com/Joaopeuko/Mql5-Python-Integration

Reason: