Python Login via mt5.login funktioniert nicht
Hallo,
ich habe es mit zwei Installation, auch dem Metaquotes-Original-MT5 versucht, aber ich bleibe hier hängen:
Mit account oder ohne (soll ja dann aus dem Speicher des Terminals genommen werden), mit Passwort oder ohne, es klappt nicht.
Hier der Code, bitte eigenen Account nutzen:
initialize() funktioniert, das ist aber auch alles.
Dank & Grüße,
Christian
MetaTrader5 package author: MetaQuotes Ltd. MetaTrader5 package version: 5.0.36 (500, 3180, '28 Jan 2022') connected to account #28889968 Process finished with exit code 0
Lösung steht im geänderten Code
import MetaTrader5 as mt5 # display data on the MetaTrader 5 package print("MetaTrader5 package author: ", mt5.__author__) print("MetaTrader5 package version: ", mt5.__version__) # establish connection to the MetaTrader 5 terminal if not mt5.initialize(login=28889968, server="MetaQuotes-Demo",password="3ibqypsb"): print("initialize() failed, error code =", mt5.last_error()) quit() # display data on MetaTrader 5 version print(mt5.version()) # connect to the trade account without specifying a password and a server authorized = mt5.login(login=28889968, server="MetaQuotes-Demo",password="3ibqypsb") # the terminal database password is applied if connection data is set to be remembered if authorized: print("connected to account #{}".format(account)) else: print("failed to connect at account #{}, error code: {}".format(account, mt5.last_error())) """ # now connect to another trading account specifying the password account=12345678 authorized=mt5.login(account, password="xyz") if authorized: # display trading account data 'as is' print(mt5.account_info()) # display trading account data in the form of a list print("Show account_info()._asdict():") account_info_dict = mt5.account_info()._asdict() for prop in account_info_dict: print(" {}={}".format(prop, account_info_dict[prop])) else: print("failed to connect at account #{}, error code: {}".format(account, mt5.last_error())) """ # shut down connection to the MetaTrader 5 terminal mt5.shutdown()
Jep, hab's hinbekommen, danke!
Hallo,
ich habe es mit zwei Installation, auch dem Metaquotes-Original-MT5 versucht, aber ich bleibe hier hängen:
Mit account oder ohne (soll ja dann aus dem Speicher des Terminals genommen werden), mit Passwort oder ohne, es klappt nicht.
Hier der Code, bitte eigenen Account nutzen:
initialize() funktioniert, das ist aber auch alles.
Dank & Grüße,
Christian