- initialize
- login
- shutdown
- version
- last_error
- account_info
- terminal_info
- symbols_total
- symbols_get
- symbol_info
- symbol_info_tick
- symbol_select
- market_book_add
- market_book_get
- market_book_release
- copy_rates_from
- copy_rates_from_pos
- copy_rates_range
- copy_ticks_from
- copy_ticks_range
- orders_total
- orders_get
- order_calc_margin
- order_calc_profit
- order_check
- order_send
- positions_total
- positions_get
- history_orders_total
- history_orders_get
- history_deals_total
- history_deals_get
initialize
Establish a connection with the MetaTrader 5 terminal. There are three call options.
Call without parameters. The terminal for connection is found automatically.
initialize() |
Call specifying the path to the MetaTrader 5 terminal we want to connect to.
initialize(
|
Call specifying the trading account path and parameters.
initialize(
|
Parameters
path
[in] Path to the metatrader.exe or metatrader64.exe file. Optional unnamed parameter. It is indicated first without a parameter name. If the path is not specified, the module attempts to find the executable file on its own.
login=LOGIN
[in] Trading account number. Optional named parameter. If not specified, the last trading account is used.
password="PASSWORD"
[in] Trading account password. Optional named parameter. If the password is not set, the password for a specified trading account saved in the terminal database is applied automatically.
server="SERVER"
[in] Trade server name. Optional named parameter. If the server is not set, the server for a specified trading account saved in the terminal database is applied automatically.
timeout=TIMEOUT
[in] Connection timeout in milliseconds. Optional named parameter. If not specified, the value of 60 000 (60 seconds) is applied.
portable=False
[in] Flag of the terminal launch in portable mode. Optional named parameter. If not specified, the value of False is used.
Return Value
Returns True in case of successful connection to the MetaTrader 5 terminal, otherwise - False.
Note
If required, the MetaTrader 5 terminal is launched to establish connection when executing the initialize() call.
Example:
import MetaTrader5 as mt5
|
See also