MetaTrader 5 Python User Group - the summary - page 5

 
MetaTrader5\__init__.py", line 35, in <module>
    from .C import *
ImportError: DLL load failed: The specified module could not be found.

Hey guys, I have been getting this error when trying to import MetaTrader5 module in Python 3.7.

Does anyone know how to fix this?

 
jaffer wilson:
How I can download history of using the Python API similar to how the Strategy Tester Downloads?

I found reply related to Python 3.5.0 -

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020/01/26 21:53

It is included Python versions 3.6, 3.7, and 3.8 in the version 5.0.11.

Unfortunately, we will not support older Python versions. Soon we will rewrite the entire library from scratch and add many functions, including trading.

 

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020/01/26 21:39

Has anyone already used Python integration in MetaEditor in builds 2302 and higher (beta build 2304 is better)?


Now the first version of integration into the editor is working, and then it will be:

  • running scripts (not experts) and services in the form of Python * .py programs
  • fully rewritten python library metatrader5 with access to charts, symbols, trading opportunities, trading history
  • editor highlight

Already running the launch in the editor * .py and * .ipynb programs.

Try it please.


After we finish machine learning through python scripts, let's move on to implementing WinML with ONNX natively in MQL5 itself.


 
Sergey Golubev:

I found reply related to Python 3.5.0 -

I guess my question was clear. How I can download history of using the Python API similar to how the Strategy Tester Downloads?

Here there is nothing related to Python 3.5.0.

Please let me know the answer to that question. I know I previously had asked something related to Python 3.5.0. But it was answered and I let it that way. But this time question is different.

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
The idea of ​​automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot does not get tired, doubtful or scared, it's is totally free from any psychological problems. It is sufficient enough to clearly formalize the trading rules and implement them in the algorithms, and...
 
jaffer wilson:

I guess my question was clear. How I can download history of using the Python API similar to how the Strategy Tester Downloads?

Here there is nothing related to Python 3.5.0.

Please let me know the answer to that question. I know I previously had asked something related to Python 3.5.0. But it was answered and I let it that way. But this time question is different.

Yes, it was answered. But many users here are not going to Russian forum to find some significant posts made by MetaQuotes and admins.
So, I am finding some posts there to re-post it here.

If I find the reply to your question related to downloading the history so I will post it here as well.

 

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020/01/28 15:27

In addition to Python integration, we are working on native support for the functions of manipulating large data arrays both in code and in MetaEditor:

  1. SQLite Browser in MetaEditor is already available in beta



  2. View in tabular form CSV files, including packed in zip / gz

    Datasets are usually distributed in CSV formats, and even packaged in gz / zip. We will give the opportunity to view (and probably edit) huge files in a tabular form, which is practically not available in other editors.

  3. Extensions of DatabaseXXX functions of the form DatabasePrint, DatabaseExport, DatabaseImport

    Using these functions, you can easily convert CSV files to SQLite databases, export or print them.

    It is enough to import a text CSV database into SQLite once, then to use the amazing (at the C ++ level) speed of fetching and accessing data. Our SQLite implementation is virtually lossless compared to C ++ implementations.

  4. Let us add SQLite files as resources to EX5 programs

    Resources are automatically compressed, which will make it possible to distribute programs of moderate size and use them in a cloud network.


 

The question- post

I looked at what WinML is, a rather interesting thing, I would have figured it all out))
Do I understand correctly that after implementing WinML with ONNX, in fact, machine learning from the MetaTrader5 box will become available in mql5?
And trained models in WinML, can be used directly in MetaTrader5 programs?

The reply- post

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020/01/28 15:11

Yes exactly.

It will be possible to create very complex systems and sell them in the market. And they should work in theory faster.

Research can be carried out in any systems, then export trained models to ONNX format and start working in their native way in WinML.

----------------

The question- post #333

In this regard, another question.
How do you plan to integrate trained models into mql5 code?
Will it be directly the integration of trained code into mql code?
Or will each model be stored in a separate file, and this file will be connected in the likeness of an inclusion?

The reply- post #336

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020/01/28 15:28

ONNX + WinML: https://docs.microsoft.com/en-us/windows/ai/

Read it yourself on this topic. It is huge and it can’t be painted on the fingers in the forum.


 

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020.01.29 06:11

The problem is the narrow perception of the topic by the masses and the lack of understanding of the development trends of algorithmic trading:

  • Machine learning is the next technological step in algorithmic trading
  • Python is not a C ++ library, but a platform that won the machine learning race
  • Python integration into the editor and terminal makes it possible to instantly use ready-made and absolutely intolerable decision-making libraries
  • Integration is the norm, we have a Native DLL, .NET DLL, OpenCL, DirectX, SQLite in addition to a large set of regular functions and a standard library
  • Metatrader 5 along with MQL5 are developing with might and main towards machine learning support: first through the Python library the Terminal API integration library, functions for working with massive data, and then switching to regular WinML and open ONNX model formats

People remind ostriches just:

  • trying to talk about the complexity of MQL5 and the advantages of MT4
  • not developing, saving their strength
  • trying to stop progress


To better understand the industry of algorithmic trading:

  1. think on a large scale of tens of millions of consumers, rather than personal / private perceptions or opportunities
  2. evaluate periods of 5-10 years and development trends, public information is enough
  3. products (robots, indicators, ...) are developed mainly by more or less professional programmers who need more and more features, including distribution
  4. you either accept progress or stay overboard


 

Forum on trading, automated trading systems and testing trading strategies

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

Renat Fatkhullin , 2020/02/12 09:20

Since version 5.0.15, the Python library works in a new format that is not compatible with the old format and requires the latest beta terminal.

We’ll publish updated documentation and examples soon.


 

Did the pip install and importing the lib gives no error.

However when executing the test script

from datetime import datetime
from MetaTrader5 import *
from pytz import timezone
import matplotlib.pyplot as plt
utc_tz = timezone('UTC')
 
 
# connect to MetaTrader 5
MT5Initialize()
# wait till MetaTrader 5 establishes connection to the trade server and synchronizes the environment
MT5WaitForTerminal()
 
# request connection status and parameters
print(MT5TerminalInfo())
# get data on MetaTrader 5 version
print(MT5Version())

 I get this as output -

NameError: name 'MT5Initialize' is not defined
NameError: name 'MT5WaitForTerminal' is not defined



Why?

Reason: