Skip to content

Repository files navigation

Claude MT5 Trader

An AI-powered trading system that connects Claude to MetaTrader 5 — covering strategy definition, backtesting, walk-forward validation, demo execution, supervised live trading, and autonomous live trading with safeguards.


Built on the shoulders of Lewis Jackson

This system is built as a companion to Lewis Jackson's TradingView MCP connector:

Lewis built and open-sourced the TradingView MCP connector that allows Claude to read live chart data in real time. This repo extends that foundation by adding MetaTrader 5 connectivity, backtesting infrastructure, and a full execution pipeline.

If you haven't set up the TradingView connector first, start there:

https://github.com/LewisWJackson/tradingview-mcp-jackson

What this system does

Phase What it builds
Strategy Defines your rules in rules.json — any strategy, any market
MT5 Bridge Python MCP server + Expert Advisor connects Claude to MetaTrader 5
Backtest Walk-forward test: 70% train, 30% unseen validation
Demo Fires real signals on a demo account — real conditions, no risk
Supervised live Real money — Claude signals, you approve before each trade fires
Autonomous live Full auto within your risk limits — kill switch always on

What this system is NOT

  • It is not financial advice. Every strategy is the user's own.
  • It does not place trades without your explicit consent (until you enable autonomous mode — which requires multiple deliberate steps).
  • It is not a get-rich-quick system. It automates the mechanical execution of rules you define. The edge comes from your strategy, not from Claude.

Architecture

Claude Code
    │
    ├── tradingview-mcp-jackson/    ← Lewis Jackson's connector (TradingView)
    │       rules.json              ← shared strategy config (lives here)
    │       .env                    ← shared secrets
    │
    └── claude-mt5-trader/          ← this repo (MT5)
            mt5-bridge/
                mt5_server.py       ← Python MCP server (reads MT5 data)
                backtest.py         ← walk-forward backtester
                ClaudeSignalEA.mq5  ← MT5 Expert Advisor (executes signals)
                signals/            ← signal handoff between Python and EA
            scripts/
                notify.py           ← Telegram / Gmail delivery
            logs/                   ← trade logs (gitignored)
            PROMPT_MT5_TRADING_SYSTEM.md  ← paste into Claude Code to run

The rules.json strategy file lives in tradingview-mcp-jackson so both systems share a single source of truth. The path is configurable via RULES_PATH in .env.


Quick start

  1. Set up Lewis's TradingView connector first (link above)
  2. Open a fresh Claude Code session
  3. Paste the contents of PROMPT_MT5_TRADING_SYSTEM.md — Claude walks you through the rest

That's it. The prompt handles Python installation, MT5 connection, strategy building, backtesting, and execution setup.


File structure

claude-mt5-trader/
├── README.md
├── PROMPT_MT5_TRADING_SYSTEM.md   ← the onboarding prompt
├── .env.example                   ← copy to .env and fill in
├── .gitignore
├── mt5-bridge/
│   ├── mt5_server.py              ← MCP server (Python)
│   ├── backtest.py                ← walk-forward backtester
│   ├── ClaudeSignalEA.mq5         ← MT5 Expert Advisor (MQL5)
│   └── signals/                   ← signal files (gitignored)
├── scripts/
│   └── notify.py                  ← Telegram / Gmail notifications
├── pine/                          ← Pine Script storage (if using Branch B)
└── logs/                          ← trade logs (gitignored)

Credits

What Who Where
TradingView MCP connector Lewis Jackson github.com/LewisWJackson
TTFM strategy methodology TTrades youtube.com/@TTrades_edu
MT5 Python library MetaQuotes pypi.org/project/MetaTrader5
AI engine Anthropic Claude anthropic.com

Disclaimer

This software is provided for educational and research purposes. Trading financial instruments carries significant risk. Past performance (including backtest results) does not guarantee future results. You are solely responsible for any trades placed using this system. Always test on a demo account before using real money.

About

AI-powered MT5 trading system - strategy builder, walk-forward backtester, and live execution. Built on Lewis Jackson's TradingView MCP framework.

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages