'AttributeError: 'builtin_function_or_method' object has no attribute 'balance' [MT5]
I am using python to write some trading code, however, I have received error as above. I know it connected to MT5 since I also tried different account I had for connection and it works, however, I am unable to retrieve any account information.
Anyone experience enough to help? Would I be missing some installation? I am building this from VSCode if you are asking.
import MetaTrader5 as mt5
from datetime import datetime
if not mt5.initialize():
print("initialize() failed, error code =",mt5.last_error())
quit()
D_login = xxx
D_pw = xxx
D_Server = xxx
mt5.login(D_login, D_pw, D_Server)
acc_info = mt5.account_info
print(acc_info)
bal = acc_info.balance
equity = acc_info.equity
print('Balance :', bal)
print('Equity :', equity)
Solution 1:[1]
Change mt5.account_info to mt5.account_info(). You need to call the function.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | adang1345 |
