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

 
Сергей Таболин:

Another question from a newcomer.

The situation is as follows. I have an indicator. When I add it to the chart in "cold" mode, it takes 7-8 seconds to be calculated.

I have done the same in python. The difference is that python writes the data in a .csv file.

I understand connection losses with MT5, other overheads.... But, 8 seconds vs 3 hours..... ???????? HOW ???????????

What do you want from a language which is a hundred times slower than C++?

Everything fast in Python is written as C++ modules. If there is no suitable fast module, everything will be infinitely slower.


copy_ticks_range, as well as the rest of the data extraction methods in the Python API are written by us super efficiently and quickly at the level of giving that data to MQL5.
 
Renat Fatkhullin:

What do you want from a language which is a hundred times slower than C++?

Everything fast in Python is written as C++ modules. If there's no suitable fast module, everything will be infinitely slower.


copy_ticks_range, as well as other methods of data extraction in Python API are written by us super efficient and fast at the level of giving this data in MQL5.

Slower, not by HUNDREDS....

Thanks, Renat, for the reply. I take it that this speed is solely at the mercy of Python? I myself thought that neither calling for ticks in MT, nor writing data to a file could slow down so much...

 

Now do you see why we put so much effort into language performance?

Otherwise it is impossible to handle modern volumes.

We do not support Python by itself, but as a bridge to efficient libraries written for it (in C++).

 
Renat, can you give a brief overview of how far you've come with the new tester?

Then surely an API functionality will be included to use the tester with Python, won't it?

Greetings
 
Christian:

Then surely an API functionality will be included to use the tester with Python, won't it?

No. It's naive to think that we would commit suicide and choose a language a hundred times slower than our own in order to kill a tester.

It is much more profitable for us to develop our idea of recompiling third-party C++ libraries into MQL5 modules. To do this, we have started to include an external LLVM compiler in the editor.

 
Renat Fatkhullin:

No. It's naive to think that we would commit suicide and choose a language a hundred times slower than our own in order to kill a tester.

It is much more profitable for us to develop our idea of recompiling third-party C++ libraries into MQL5 modules. To do this we have started to include the external LLVM compiler into the editor.

Is there any hope of developing the idea to supportC/C++.lib or .a static library linking into mql program project?

 
Roman:

Is there any hope of developing the idea, in supportingC/C++.lib or .a static libraries linking into the mql program project?

No. You can always use any DLL with explicit access rights control.

 
I understand connection losses to MT5, other overheads.... But, 8 seconds vs 3 hours..... ???????? HOW ???????????

Give me an example of your Python code that slows down, it's not clear from the words what it does and how you get the data. And why does it constantly write to the file? Can't it be done at the end?

 
Renat Fatkhullin:

No. It's naive to think that we would commit suicide and choose a language a hundred times slower than our own in order to kill a tester.

It is much more profitable for us to develop our idea of recompiling third-party C++ libraries into MQL5 modules. To do this, we have started to include the external LLVM compiler into the editor.

And if, hypothetically, you take ONNX support, the imported models will be slower than MQL itself?

 

Noticed an oddity in the output:

[89, '2020.01.16', 3, 15, 3, 16, Timedelta('0 days 01:16:53.966000')]
[90, '2020.01.16', 3, 16, 3, 17, Timedelta('0 days 00:25:39.266000')]
[91, '2020.01.16', 3, 17, 4, 12, Timedelta('0 days 19:07:12.757000')]
[92, '2020.01.17', 4, 12, 4, 13, Timedelta('0 days 00:36:14')]
[93, '2020.01.17', 4, 13, 4, 15, Timedelta('0 days 02:21:01.630000')]
[94, '2020.01.17', 4, 15, 4, 17, Timedelta('0 days 02:12:28.692000')]
[95, '2020.01.17', 4, 17, 0, 11, Timedelta('0 days 17:30:16.404000')]

Is it == 00:36:14.000000 ?

Reason: