MetaTrader 5 Python User Group - how to use Python in Metatrader - page 60
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Version 5.0.30 is out
Thank you!
Version 5.0.31 is out
Any major changes?
No, just some fixes for https://www.mql5.com/en/forum/306742/page13#comment_15699363
https://pypi.org/project/pymt5adapter/
https://github.com/nicholishen/pymt5adapter
Thanks, this example I saw, it works.
I'm a bit about something else.
positions_get - the list of TradePosition will be returned to me. In principle, you can throw in pandas and work fine.
But everything is not limited to one pandas, and if you need to get something like:
you have to somehow compose, pandas or for... somehow a lot of extra body movements.
It has become much more convenient with _asdict (), if the one who writes is not a MQL5 prog, but let's say a pythonist ... or a datasynetist, then list / dict is
The basic elements of python, many are building a data transfer on list / dict.
Tuples are used, too often and a lot, but only if you need to tightly control the types of data that move in it.
and also hang an error handler, if not used or assigned properly. Well, somewhere ... :) I could be wrong.
Ok I completely agree with this sentiment now, and I also think that returning data as namedtuples instead of dictionaries is too opinionated for an API. I recently had issues with this design because it is impossible to pickle namedtuples. Consider the following concurrent trade copier script. Notice how much of a hassle it is to convert all the namedtuples to dictionaries in order to make use of the ProcessPoolExectutor?
trade_copier.py
terminal_config.json
It's especially difficult when there are namedtuples nested inside of namedtuple, such as the case with OrderSendResult.request. So you have to create unique conversion functions just to convert them back to pickleable datatypes. You could run everything through a recursive function to convert it back to native datatypes, but this is computationally expensive.
https://pypi.org/project/pymt5adapter/
https://github.com/nicholishen/pymt5adapter
Failed to install
Win10, Py3.6.10 and WinPy3.7.7.