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

 
Renat Fatkhullin:

The API and library have been completely rewritten, the old methods no longer work.

Here is new description and example: https://www.mql5.com/ru/forum/306688/page37#comment_14972868

OK, the point is clear. Please correct the official documentation to avoid confusion. Or reference to the fact that for the code in the off-doc should use .11 lib and some version of the terminal,

while this lib is in beta release.


Another question, how path is processed in initialize(path=None), if path=None, what is the logic to select the terminal the lib works with?

Whaterror codes are returned and what is their meaning?

 

Next Friday we will release the MT5 release and update the documentation at the same time.

The descriptions of the old interfaces in the forum will also be edited.


By default, the terminal that was last started under the user account is launched. The directory C:\Users\%username%\AppData\Roaming\MetaQuotes\Terminal is searched and the most recent instance is selected.

The answer codes are wrapped in tuple and are similar to the answer codes in MQL5.

We will describe it later in the documentation.

 
Renat Fatkhullin:

Next Friday we will release the MT5 release and update the documentation at the same time.

The descriptions of the old interfaces in the forum will also be edited.


By default , the terminal is started in the terminal that was last started under the user account. Look through the directory C:\Users\%username%\AppData\Roaming\MetaQuotes\Terminal and select the most recent instance.

The answer codes are wrapped in tuple and are similar to the ones in MQL5.

We will describe it later in the documentation.

What about fans of the portable mode of the terminal?

 
Aleksey Vyazmikin:

What about fans of portable mode of operation of the terminal?

I don't think this will affect the MT's /portable mode in any way.

 
Renat Fatkhullin:


By default , the terminal that was last started under the user account is started. The directory C:\Users\%username%\AppData\Roaming\MetaQuotes\Terminal is searched and the most recent instance is selected.

I.e. if C:\Users\username%\AppData\Roaming\MetaQuotes\Terminal, after installing two terminals we have:


(.env) PS C:\Users\%username%\AppData\Roaming\MetaQuotes\Terminal> ls


    Directory: C:\Users\%username%\AppData\Roaming\MetaQuotes\Terminal


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        2/15/2020   9:53 PM                36 A64B8C79A6163D85E6173B54096685
d-----       10/19/2019  10:51 AM                Common
d-----         2/5/2020   5:44 PM                Community
d-----        2/15/2020  11:27 PM                D0E8209F77C8CF37AD8BF550E51FF075
d-----        2/14/2020   2:37 PM                Help


(.env) PS C:\Users\%username%\AppData\Roaming\MetaQuotes\Terminal>

Then from 36A64B8C79A6163D85E6173B54096685 or D0E8209F77C8CF37AD8BF550E51FF075 the last instance installed and running after installation is called, but not the last terminal running under this user.

Is this correct?

 
Renat Fatkhullin:

Next Friday we will release the MT5 release and update the documentation at the same time.

The descriptions of the old interfaces in the forum will also be edited.


Have the constants changed as well?

                rates = mt5.copy_ticks_range(self.__symbol__, mt5.MT5_TIMEFRAME_M1, ts1, ts2)

On the way out:

AttributeError: module 'MetaTrader5' has no attribute 'MT5_TIMEFRAME_M1'
 

The terminal that was closed last is now started. The opening terminal will open the broker and the account that was at closing (?).

In the new release they promise to make an explicit opening (path, broker, login).

It is not convenient the way it is done now, we have to fix it by hand. Or to open terminal with required broker and account beforehand.

Let's wait for the new release.

 
Vladimir Perervenko:

The terminal that was closed last is now started. The opening terminal will open the broker and the account that was at closing (?).

In the new release they promise to make an explicit opening (path, broker, login).

It is not convenient the way it is done now, we have to fix it by hand. Or to open terminal with required broker and account beforehand.

We will wait for the new release.

Yes, it would be very convenient.

And if the event handler will be available with python lib, it will be fantastic :)

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

Have the constants also changed?

On the output:

import MetaTrader5

dir(MetaTrader5)
 
Roman:

They have dumped into the global environment everything they need and everything they don't need at all. It already happened with the library for R.

Well, maybe someone will suggest it and fix it. I'm not an expert in Python, so I can not say whether it's really an error.

We are waiting for the release.