Why does my python script need to open Mt5's window to work ?

XasmY
58
XasmY  

blblablabl


Hello, 


I use MetaTrader5 library for python.
I call connectToAccount from main function.


I don't understand why MetaTrader5's window needs to be open.
If I block this opening my script sleeps until the window is opened.

Is there a way to make it work without opening the Mt5 window ?

Thank you ! 

import MetaTrader5 as mt5

def connectToAccount(account, pswd):
        if not mt5.initialize():
                print("initialize() failed, error code =", mt5.last_error())
                quit()

        account = *****
        authorized = mt5.login(account, password="******")
        if authorized:
                        print("Connected to account #{} ".format(account))
        else:
                print("failed to connect at account #{}, error code: {}".format(
                        account, mt5.last_error()))


mtAccount.connectToAccount("******", "*******")
mtAccount.disconnectToAccount()
Fernando Carreiro
6548
Fernando Carreiro  
XasmY: I use MetaTrader5 library for python. I call connectToAccount from main function. I don't understand why MetaTrader5's window needs to be open. If I block this opening my script sleeps until the window is opened. Is there a way to make it work without opening the Mt5 window ?

Obviously because the MetaTrader terminal is the actual work-horse that does all the main work of collecting the data from the broker and sending and processing all the trading details. It works as server environment where the python integration is a client environment.

XasmY
58
XasmY  
Fernando Carreiro:

Obviously because the MetaTrader terminal is the actual work-horse that does all the main work of collecting the data from the broker and sending and processing all the trading details. It works as server environment where the python integration is a client environment.

So it's not possible to not open the window ?