Attachments forums

List of attachments posted on this forum.


All files on forums: 164249

Re: Banzai's [MT5] [Python] Personal AI Trading Co-pilots

Banzai, Fri Jan 16, 2026 6:55 am

🔗 Architecture (Simple & Reliable)
MT5 terminal (logged in)

MetaTrader5 Python API

Python Agent (Market Watcher)

Trend / Volatility / Levels / Candle Logic
⚠️ Important truth:
  • MT5 does NOT push data outward
  • Python pulls data from MT5
  • This is stable, fast, and widely used in algo trading

https://www.python.org/downloads/windows/
Download Python version 3.10.11. 64 bit. Other versions don't work. MT5 is way behind technology.

Code: Select all

https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe
✅ Step 1 — Install Required Software
1️⃣ Install Python (if not already)
  • Version: Python 3.9 – 3.11
  • ✔️ Check “Add Python to PATH”
Verify:

Code: Select all

python --version

2️⃣ Install MetaTrader5 Python Package

Code: Select all

pip install MetaTrader5 pandas numpy

✅ Step 2 — Prepare MT5 Terminal
In MT5:
  1. Open MT5
  2. Login to your trading account
  3. Go to:

    Code: Select all

    Tools → Options → Expert Advisors
  4. Enable:
    • ✅ Allow algorithmic trading
    • ✅ Allow WebRequest (optional for later)
  5. Keep MT5 OPEN (Python connects to the running terminal)

✅ Step 3 — Test MT5 → Python Connection
Minimal Connection Test

Code: Select all

import MetaTrader5 as mt5

# Initialize MT5 connection
if not mt5.initialize():
    print("MT5 initialize failed")
    mt5.shutdown()
else:
    print("MT5 connected successfully")

# Check account info
account = mt5.account_info()
print(account)

mt5.shutdown()
✔️ If this prints your account details → you’re connected
✅ Step 4 — Pull XAUUSD Market Data
Fetch Candles (OHLC)
i

Code: Select all

mport MetaTrader5 as mt5
import pandas as pd

mt5.initialize()

SYMBOL = "XAUUSD"
TIMEFRAME = mt5.TIMEFRAME_M5   # 5-minute candles
BARS = 300

rates = mt5.copy_rates_from_pos(SYMBOL, TIMEFRAME, 0, BARS)

df = pd.DataFrame(rates)
df['time'] = pd.to_datetime(df['time'], unit='s')

print(df.tail())

mt5.shutdown()
This gives you:
  • Open
  • High
  • Low
  • Close
  • Volume
  • Time
🔥 This is your raw feed for Agent 1
All files in topic