MQL4 Reference MQL5 features MQL5 functions Integration

MetaTrader module for integration with Python

Python is a modern high-level programming language for developing scripts and applications. It contains multiple libraries for machine learning, process automation, as well as data analysis and visualization.

MetaTrader package for Python is designed for convenient and fast obtaining of exchange data via interprocessor communication directly from the MetaTrader 5 terminal. The data received this way can be further used for statistical calculations and machine learning.

Functions for integrating MetaTrader 5 and Python

Function

Action

MT5Initialize

Establish a connection with the MetaTrader 5 terminal

MT5Shutdown

Close the previously established connection to the MetaTrader 5 terminal

MT5TerminalInfo

Get status and parameters of the connected MetaTrader 5 terminal

MT5Version

Return the MetaTrader 5 terminal version

MT5WaitForTerminal

Wait till the MetaTrader 5 terminal connects to the trade server

MT5CopyRatesFrom

Get bars from the MetaTrader 5 terminal starting from the specified date

MT5CopyRatesFromPos

Get bars from the MetaTrader 5 terminal starting from the specified index

MT5CopyRatesRange

Get bars in the specified date range from the MetaTrader 5 terminal

MT5CopyTicksFrom

Get ticks from the MetaTrader 5 terminal starting from the specified date

MT5CopyTicksRange

Get ticks for the specified date range from the MetaTrader 5 terminal