MetaTrader 5 Python User Group - how to use Python in Metatrader - page 55

 
Vladimir Perervenko:

I am watching Pypi. The developers are waiting for comments from us for continuation/improvement. But so far we don't see any user activity in this area.

In a separate branch, I think we need to discuss common infrastructure issues for complex trading systems (terminal (MT4/MT5) <-> TS (on different IPs) <_> databases are different. Different configurations, problems, difficulties, advantages.

Good luck

The appearance of the new release - yes, I'm there too.

And what's new in it, at least, what does it affect?

 
Дмитрий Прокопьев:

The arrival of the new release - yes, I'm there too.

What's new about it, though, what does it affect?

Nothing drastic, as far as I'm concerned. It's just a little tidying up. We have enough of that set of commands for interaction with the terminal to start using it.

We will work a bit with various variants and the picture will get clearer.

 
Vladimir Perervenko:

Nothing drastic, in my opinion. It's just the little things that have been cleaned up. The set of commands for interacting with the terminal is enough to start using it.

Let's work a little with different variants, the picture will become clear.

In principle, yes, I agree :) enough, but I'm hoping for one tasty ... :)

Has something for work with named tuple appeared (likeTradeDeal), for example to get them as a list of _asdict()?

 

Please advise how to set the path for initialize correctly.

I am doing this:

if not mt5.initialize("C:\Program Files\MetaTrader5\terminal64.exe"):
    print("initialize() failed, error code =",mt5.last_error())
    quit()

I get an error:

MetaTrader5 package author:  MetaQuotes Software Corp.
MetaTrader5 package version:  5.0.29
initialize() failed, error code = [-10003, "IPC initialize failed, Process create failed 'C:\\Program Files\\MetaTrader5\terminal64.exe'"]

Environment: Python 3.8 (64-bit)

OS: Win10 (x64)

Документация по MQL5: Интеграция / MetaTrader для Python / initialize
Документация по MQL5: Интеграция / MetaTrader для Python / initialize
  • www.mql5.com
[in]  Путь к файлу metatrader.exe или metatrader64.exe. Необязательный неименованный параметр. Указывается первым без имени параметра. Если путь не указан, модуль попытается найти исполняемый файл самостоятельно. [in]  Таймаут в миллисекундах, который дается на подключение. Необязательный именованный параметр. Если не указан, то будет...
 
Denis Kirichenko:

Please advise how to correctly set the path for initialize.

I am doing this:

I get an error:

Environment: Python 3.8 (64-bit)

OS: Win10 (x64)

Here's the head, 2 ears... Got it. Need to write path like this:

'C:\\Program Files\\MetaTrader5\\terminal64.exe'
Symbolic constants must not be forgotten...
Документация по MQL5: Основы языка / Типы данных / Целые типы / Символьные константы
Документация по MQL5: Основы языка / Типы данных / Целые типы / Символьные константы
  • www.mql5.com
Символы, как элемент строки, в MQL5 - это индексы в наборе символов Unicode. Они являются 16-разрядными значениями, которые можно преобразовывать в целые числа и с которыми можно манипулировать целочисленными операциями, такими как сложение и вычитание. Любой одиночный символ, заключенный в одинарные кавычки, или шестнадцатеричный ASCII-код...
 
Denis Kirichenko:

Here's the head, two ears... I've got it. You have to write the path like this:

'C:\\Program Files\\MetaTrader5\\terminal64.exe'
Character constants should not be forgotten...

Correct like this: 'C:\\\Program Files\\MetaTrader5\\\terminal64.exe', don't forget the quota \.

There is one more thing, version 5.0.27 of MetaTrader5 will not work correctly with the build 2366 terminal, only 5.0.28

Even at the initialization stage there will be problems, it is necessary to pull up the update of the libas. In reverse - 5.0.28 with an earlier version of the terminal, I haven't noticed any difficulties yet.

 
Дмитрий Прокопьев:

The correct way is: 'C:\\\Program Files\\MetaTrader5\\terminal64.exe', don't forget to quota \\.

There is one more thing, version 5.0.27 of MetaTrader5 will not work correctly with the build 2366 terminal, only 5.0.28

Even at the initialization stage there will be problems, it is necessary to pull up the update of the libas. In reverse - 5.0.28 with earlier version of terminal, no difficulties noticed yet.

The latest is 5.0.29.

How many terminals do you have MT5? Just for the sake of interest.

 

An additional terminal may be needed in three cases:

-another broker and account

-Another account at the same broker

- or the number of strategies connected to the terminal is over the maximum.

May be some one tried to load the terminal with scripts to detect this maximum? I'll try it later.

 
Vladimir Perervenko:

The latest is 5.0.29.

How many MT5 terminals do you have? Just out of interest.

Yeah right, thanks.

There are 6 in maiden, 3 in prod according to the ToR.
 
Vladimir Perervenko:

An additional terminal may be needed in three cases:

-another broker and account

-Another account at the same broker

- or the number of strategies connected to the terminal is over the maximum.

May be some one tried to load the terminal with scripts to detect this maximum? I will try it later.

I've tried it, it all depends on the hardware I'm running it on.

One instance eats somewhere around 45-50Mb RAM + 2,5-4% CPU. (Yes, % CPU depends on CPU type, in my case it's Intel Xeon L5640 @ 2.27GHz)

The same, one instance of python.

If python runs with history, + 200-300Mb RAM. CPU is almost not used up.

Well, what for, it depends on TOR or idea.