metatrader error when trying to login with Python, error code = (-10005, 'IPC timeout')

 

I am trying to login to Metatrader account and I have been receiving this error code.


Please see code below;

I first import necessary libraries and initialize which works fine

from datetime import datetime

import MetaTrader5 as mt5



mt5.initialize()

But when I try to log in using the below code, I receive this error - 

failed to connect at account #51166970, error code: (-10005, 'IPC timeout')

In  [14]:


account=51166970

authorized=mt5.login(account, password='z6kjjrtr', server='ICMarketsSC-Demo')

if authorized:

    print(mt5.account_info())

    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()))

I also read some post about similar errors which asked I specify the path, please see post links (https://stackoverflow.com/questions/58028717/metatrader5-libarary-in-python-3-7 and https://stackoverflow.com/questions/63975284/mt5-metatrader-5-connect-to-different-mt5-terminals-using-python and https://www.mql5.com/en/forum/438477), so I edited my code but received this error - initialize() failed, error code = (-10005, 'IPC timeout')

As noted in an answer here (https://stackoverflow.com/questions/66492735/metatrader-error-initialize-failed-error-code-10005-ipc-timeout/72851156#72851156) I changed my path from

"C:\Program Files\MetaTrader 5\terminal64.exe"

to

"C:/Program Files/MetaTrader 5/terminal64.exe"


#start the platform with initialize()
if not mt5.initialize("C:/Program Files/MetaTrader 5/terminal64.exe", login=22000642, password="duzhhjkd8", server="Deriv-Demo"):   
    print("initialize() failed, error code =", mt5.last_error())
else:
    mt5.login(login=22000642, password='duzhhjkd8', server='Deriv-Demo')


How can I rectify this

MetaTrader5 libarary in Python 3.7
MetaTrader5 libarary in Python 3.7
  • 2019.09.20
  • Çağlar Can Sarıkaya
  • stackoverflow.com
I am trying to analyze currency data using MT5 in Python but it is not working. I didn't understand where is the problem? even importing is not work This is the error:
 

Please any Answer to the Question Above, it'll be really Helpful.
T for Thanks