Skip to content

Repository files navigation

Mt5-traderBot

Hybrid AI-trading bot for MetaTrader 5, designed to run on Linux/Ubuntu and control a real MetaTrader 5 terminal on Windows through a lightweight REST bridge.

Architecture

┌─────────────────────┐         REST/HTTP          ┌──────────────────────┐
│  Ubuntu Bot         │  ───────────────────────▶  │  Windows MT5 Bridge  │
│  (core/bot_engine)  │   BROKER_ADAPTER=wine-bridge│  (bridge/server.py)  │
│  strategies/risk/   │  ◀───────────────────────  │  talks to local MT5   │
└─────────────────────┘                            └──────────────────────┘

The bot never imports the Windows-only MetaTrader5 package directly. It talks to a BrokerAdapter:

  • MockBrokerAdapter — deterministic offline dev/test mode
  • MT5TerminalBridge — calls the Windows bridge over HTTP

Quick start (Linux / Ubuntu)

cd operation-mt5-avatrade
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

# Offline mock mode (no MT5 needed):
BROKER_ADAPTER=mock python -m core.bot_engine

# Live bridge mode (needs the Windows bridge running):
export BROKER_ADAPTER=wine-bridge
export MT5_BRIDGE_HOST=<WINDOWS_IP>
export MT5_BRIDGE_PORT=8080
export MT5_BRIDGE_PASSWORD=<same secret as bridge>
export MT5_LOGIN=<your login>
export MT5_PASSWORD=<your password>
export MT5_SERVER=GULFBROKERS1-Live
export TRADING_ENVIRONMENT=live
python -m core.bot_engine

Windows bridge setup

See bridge/ — copy that folder to your Windows machine, run setup.bat (as Administrator), edit .env, then run.bat.

Full guide: bridge/WINDOWS_SETUP.md

Security

  • .env and venv/ are git-ignored. Real credentials are never committed.
  • Always set a strong BRIDGE_PASSWORD and restrict the bridge's firewall to the bot's IP. Do not expose the bridge to the public internet.

Disclaimer

Trading involves substantial risk. This code is provided for educational and operational testing purposes. Use at your own risk.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages