Claude Code lives in your terminal and your editor: it reads files, runs commands and writes code. What it can't do on its own is see your MetaTrader 5 account. TraderWAI adds that with one MCP server: Claude Code reads your MT5 balance and positions, gets your broker's live price, draws levels on a real chart, backtests an idea on minute data and places orders sized from your risk, always inside the limits you set on the TraderWAI website.
There is no Expert Advisor to install and no MetaTrader to keep open. TraderWAI connects to your broker's MT5 server from the cloud.
This guide is for Claude Code, the agent you run with claude. If you use Claude in the browser or the desktop app, follow Claude + MetaTrader 5 instead: same account, different setup.
What you need
- Claude Code installed and signed in (it works with a Claude subscription or an API account).
- An MT5 account, demo or live: the login (account number), the master password and the server name exactly as MetaTrader shows it. MetaTrader 4 works the same way.
- A TraderWAI account on the Trader or Max plan. MetaTrader is available on Trader (5 accounts) and Max (10 accounts), and any of them can be MetaTrader. Charts, analysis and backtests are free on every plan, and the first paid month is 50% off. See pricing.
Step 1: add the MCP server to Claude Code
Run this in your terminal:
claude mcp add --transport http traderwai https://mcp.traderwai.comAdd --scope user if you want TraderWAI in every project, not just the current folder.
Then start Claude Code, type /mcp, choose traderwai and Authenticate. Your browser opens: sign in with Google or Microsoft and authorize access. There is no API key to paste or commit to your repo: access goes through OAuth, and your TraderWAI account is created on that first sign-in.
Step 2: connect your MT5 account
- In TraderWAI go to Settings → Brokers → Add account → MetaTrader.
- Enter the login, the master password and the server exactly as in MT5 (for example ICMarketsSC-Demo). You find it in MetaTrader under File → Login to Trade Account.
- Save. The first connection takes 1 to 3 minutes while the terminal is prepared in the cloud; after that it's instant.
Start with a demo account. Everything works the same, and you see how Claude Code behaves before real money is involved. Your password is stored encrypted and is never shown to the AI.
Step 3: what to ask
Claude Code shows each tool call and, by default, asks before running it, so you always see what is sent.
Read the market (no trades)
Your account and your broker's price
Backtest before you trade
backtest_strategy runs on TraderWAI's servers with real minute data; Claude Code is good at the part around it: comparing variants, writing the notes and keeping them in your repo.
An order sized by risk
TraderWAI sizes the trade with your account currency and the symbol's contract specs and checks your risk limits before the order reaches MT5. If a limit blocks it, the tool returns RISK_LIMIT and nothing is placed. Orders carry a stop loss by default: Claude Code only sends one without it if you explicitly ask, and accounts with a risk-per-trade limit always require it.
Rules that run without you
Conditional orders are checked every minute on TraderWAI's servers, so they keep working after you close the terminal.
Step 4: guardrails in CLAUDE.md and settings
Claude Code reads CLAUDE.md at the start of every session. Put your trading rules there:
# Trading MT5 with TraderWAI
- Use my MT5 demo account unless I name a live account in this session.
Call get_broker_accounts first and say which account you will use.
- Before execute_trade, modify_position, close_position or
create_conditional_order, show me: account, symbol, side, entry,
stop loss, take profit and size. Wait for my explicit "yes".
- Always use a stop loss. Size by risk, at most 0.5% per trade.
- If a tool returns RISK_LIMIT or PLAN_LIMIT, stop and explain.
Never retry or work around it.
- Use backtest_strategy for backtests; never compute them yourself.Then make the order tools always ask, in .claude/settings.json:
{
"permissions": {
"ask": [
"mcp__traderwai__execute_trade",
"mcp__traderwai__execute_trade_multi",
"mcp__traderwai__close_position",
"mcp__traderwai__modify_position"
]
}
}CLAUDE.md and Claude Code's own permission prompt are two separate locks. Your risk limits on TraderWAI are the third, and the AI can read them but never change them.
Suggested orders instead of direct orders
If you prefer to decide every trade yourself, ask Claude Code to use suggest_order instead of execute_trade. The suggestion says which accounts and the size on each one, plus entry, stop loss, take profit and an expiry. Then, account by account, it waits for your authorization in TraderWAI, or it's placed right away only where you allowed auto-execution for that symbol and size (Settings → Auto-execution, paid plans). The size is never reduced to make it fit.
Troubleshooting
- `/mcp` shows traderwai as failed or needing auth. Choose it and run Authenticate again; check that the URL is exactly
https://mcp.traderwai.com. - "The MetaTrader server was not found". The server name must match MT5 character by character, including -Demo, -Live or the number. Copy it from the MT5 login window.
- "MetaTrader rejected the login or password". Use the master password; the investor password is read-only. Connection attempts are limited to a few per day, so check the data before retrying.
- Symbol suffixes like EURUSD.r or XAUUSD+ are mapped automatically: write EURUSD in your prompts.
- `PLAN_LIMIT` on MetaTrader. MT4/MT5 needs Trader or Max. On Free you can try the same flow with a cTrader or TradeLocker demo.
Common questions
Do I need MetaTrader open? No. The connection runs in the cloud; your terminal and computer can be off.
Does Claude Code see my MT5 password? No. It's stored encrypted on TraderWAI and never shown to the AI.
What's the difference with Claude in the browser? The account and the tools are the same. Claude Code adds your files and your terminal: it can keep backtest notes and a trading journal in your repo and combine TraderWAI with your own scripts.
Can it trade while I'm away? Only within what you allowed: conditional orders run every minute on our servers, and suggested orders execute only on the accounts, symbols and sizes you permitted. Everything else waits for you.
Other editors? The same setup works in Cursor: see Cursor + MetaTrader 5. To backtest from any AI, read backtest a strategy with AI, and for the browser version of Claude, the Claude + MT5 quick guide.

