Currently following this tutorial to connect Python to Metatrader5: https://www.youtube.com/watch?v=zu2q28h9Uvc
I am already stuck at 1:45 where my Metatrader5 initializes correctly, it opens but doesn't login with the credentials entered in my script. I use a broker Demo account. When I login manually, it works. I don't see an error or anything. If I login manually, I am able to print out my account info via my script, so connection somehow seems ok.. It drives me crazy that such a simple thing is not working, I am not getting any errors..
This is my script:
import MetaTrader5 as mt
import pandas as pd
import plotly.express as px
from datetime import datetime
server = "ICMarketsSC-Demo"
login = myaccountid
password = "mypassword"
mt.initialize()
mt.login(login, password, server)
account_info = mt.account_info()
print(account_info)
Documentation referance: https://www.mql5.com/en/docs/integration/python_metatrader5/mt5login_py
Please let me know if you see what I am doing wrong. Thanks in advance!
You need to pass the current arguments you you giving to the login function to the initialize function, and only pass the login and password to login().