The are a lot of machine learning, process automation, as well as data analysis and visualization libraries for the Python language. The advanced language possibilities can now be applied in the platform through the Python integration module.
Python scripts run directly on platform charts, similarly to regular MQL5 programs.
MetaEditor features special integrated functions for Python development: a wizard for creating blank scripts, the ability to run directly from the editor, output of messages and errors to the common log, and so on.
To get started, specify the path to the Python executable in MetaEditor settings:
If Python is not installed on your computer, click Install to download the installation file.
Open MQL5 Wizard and select "Python Script". Next, specify the script name and select library dependencies to be included in the code.
Scripts can be created using the MQL5 Wizard, while you can instantly add required library dependencies in the code.
To run a script, press "Compile" (F7). This will open a trading platform, and the script will be launched on the current chart. Messages from the Python console (stdout, stderr) will be displayed under the Errors section.
To enable the use of the MetaTrader 5 library, install it using the following command:
pip install MetaTrader5 |
For Python integration details please read the relevant documentation.