Hello guys!
I was looking at the python API for MT5, is there any way to get the history of the equity?
I don't need the full PY method, I was just wondering if someone could give me a hint/point me to a direction to implement a way to calculate/get the equity in a specified date.
Thanks in advance
Python documentation is collected in the MetaTrader for Python section.
You need to work with trading history:
Get the number of deals in trading history within the specified interval | |
Get deals from trading history with the ability to filter by ticket or position |
- www.mql5.com
Python documentation is collected in the MetaTrader for Python section.
You need to work with trading history:
Get the number of deals in trading history within the specified interval | |
Get deals from trading history with the ability to filter by ticket or position |
If possible, could I ask you another question without opening a new thread?
I read here that by setting in the request the action key to " TRADE_ACTION_MODIFY " you can modify the parameters of the previously placed trading order, so can you also modify the volume of an open position?
I tried doing it by setting in the dictionary the action to that const, specifying the position ticket, magic, type, (new) volume (that's the parameter I wanted to update), type filling, price and type time but got the error code: 10013, that has as comment "Invalid request".
I was wondering, what did I do wrong? Obviously I would have to toss all the dictionary to have an answer, but specifically: what are the parameters I have to input to change an open position? Is it possible to do it by the python API?
I tried doing it via the Software MT5 FX PRO and it worked, but is there a thing to interact with this type of request?
Could you by any chance show a snippet of code or at least specify what are the requested parameters to make this type of request? (I tried searching in the docs but didn't find any).
Thank you in advance!.
- www.mql5.com
The position size cannot be changed. You can: either close the position completely or close part of the position. In the MQL5 language, an example for the trading class CTrade:
Partially closes a position on a specified symbol or having a specified ticket |
- www.mql5.com
The position size cannot be changed. You can: either close the position completely or close part of the position. In the MQL5 language, an example for the trading class CTrade:
Partially closes a position on a specified symbol or having a specified ticket |
Thank you for the response anyway!
So the only way to to change the volume of an open position would be to close the previous one and open a new one with a new volume? Right?
Thank you for the response anyway!
No, not really. There are two ways:
- Completely close a position and then open a new position
- Perform a partial closing operation (essentially this is item 1. - but it is performed automatically using the MQL5 language).
Links to the CTrade trading class:
Operations with positions |
|
Closes a position for the specified symbol | |
Partially closes a position on a specified symbol or having a specified ticket |
- www.mql5.com
For Python you will use
Send a request to perform a trading operation. |
The main thing is to correctly fill out the trade request
- www.mql5.com
No, not really. There are two ways:
- Completely close a position and then open a new position
- Perform a partial closing operation (essentially this is item 1. - but it is performed automatically using the MQL5 language).
Links to the CTrade trading class:
Operations with positions |
|
Closes a position for the specified symbol | |
Partially closes a position on a specified symbol or having a specified ticket |
Thank you for the answers! Have a nice day!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I was looking at the python API for MT5, is there any way to get the history of the equity?
I don't need the full PY method, I was just wondering if someone could give me a hint/point me to a direction to implement a way to calculate/get the equity in a specified date.
Thanks in advance