import MetaTrader5 as mt5
# Step 1: Initialize connection
if not [Link]():
print("❌ MT5 Initialization failed!")
quit()
else:
print("✅ Connected to MT5")
# Step 2: Show login & account info
account_info = mt5.account_info()
if account_info:
print(f"🧾 Logged in as: {account_info.login}, Balance: {account_info.balance}")
else:
print("⚠️ Unable to fetch account info")
# Step 3: Get all visible symbols from Market Watch
symbols = mt5.symbols_get()
print(f"\n📊 Live prices for {len(symbols)} symbols:\n")
for sym in symbols[:20]: # Limit to 20 symbols for clean output
tick = mt5.symbol_info_tick([Link])
if tick:
print(f"{[Link]}: Bid = {[Link]}, Ask = {[Link]}")
else:
print(f"{[Link]}: ❌ No tick data")
# Step 4: Shutdown MT5 connection
[Link]()