ai_trading_journel_mcp
AI Trading Journal: free, open-source trading journal for MT5 (MetaTrader 5)
Every MetaTrader 5 trade syncs automatically. Review your P&L calendar, journal your setups and emotions, and get AI coaching from Claude on what's working and what's losing you money, instrument by instrument.
Free forever · Open source (MIT) · Runs on your own computer · No subscription · No cloud account · Your data stays private
Website · Demo video · Features · Quick start · Claude AI coach · FAQ · Support ❤️
Why this trading journal?
Most trading journals are paid web apps that want your broker login, or spreadsheets you stop updating after a week. AI Trading Journal is different:
It fills itself in. A small, read-only MT5 Expert Advisor exports your full history and every new fill. Trades show up seconds after they close: partial closes, commissions, swaps, stop-loss changes and MFE/MAE all included.
It tells you why you're losing. Built-in analytics flag revenge trading, overtrading, widened stops, early exits, sizing up after losses and losing sessions, and put a dollar cost on each.
It has a real AI coach. Connect Claude through MCP and ask, in plain English (or by voice), "What's my worst habit on gold this month?" Claude reads your journal, writes a per-instrument review, and saves it into the app.
It's yours. Everything is stored in a local SQLite file on your machine. No account and no upload; you can read the code.
Related MCP server: Trader Journal MCP
Features
📊 Dashboard with your live account balance
Balance, equity, open P&L, today's result and all-time return, reconciled against MT5 to the cent. Win rate, profit factor, expectancy, average R and max drawdown come with comparisons to the previous period. You also get the balance curve, daily P&L, and breakdowns by instrument and session. Pick 7D, 30D, 90D, 1Y or All, or any custom date range.
📅 P&L calendar and daily journal
Every day is shaded by its result, with the trade count and win rate, plus weekly totals. Click a day to see its trades and write your pre-session plan, post-session review and mood.
🧾 Every trade, fully journaled
Trades table: filter by instrument, side, outcome, session, setup, emotion, mistake or source, search your notes, and sort any column.
Trade page: entry and exit, the stop that defines 1R (and whether you added it late or widened it), R-multiple, holding time, session, every MT5 deal, and a price-excursion bar showing how much of the move you kept.
Journal on every trade: setup, emotions, mistakes, a 1–5 rating, "followed my plan?", notes, and chart screenshots (drag, drop or paste).
🎯 Per-instrument analytics
Each symbol gets a verdict (edge, leaking, breakeven or too few trades), its own equity curve, and breakdowns by session, weekday, direction, setup, exit type, hold time, emotion and mistake. Plain-English insights come with it, e.g. "XAUUSD: Asia session accounts for −$1,978 (0% win rate) while Overlap is +$46." Broker suffixes like EURUSD.m, XAUUSD+ and #US30 are merged automatically.
🚩 Behavioural red flags, with a dollar cost
Flag | What it catches |
Revenge trading | New trades opened within N minutes of a losing close, especially at a bigger size |
Overtrading | Trades beyond your daily limit |
No stop / stop added late | Positions opened unprotected, even if you add a stop afterwards (common on mobile) |
Stop widened | Stops moved further from entry on losing trades |
Loss beyond plan | Losses bigger than 1R |
Holding losers | Losers held much longer than winners |
Early exits | Winners that kept less than 40% of their best open profit |
Sizing up after a loss | The next trade after a loss is much bigger than usual |
Losing sessions and weekdays | Times of day or days of the week that consistently lose |
🤖 AI coach (Claude via MCP)
Weekly, monthly, per-instrument and per-trade reviews: strengths, weaknesses, psychology, a concrete action plan, and if/then rules for each instrument. Each review is backed by your journal's numbers and checked against your own written trading rules. How it works ↓
More
Dictate trades from other brokers ("short NAS100 at 20150, out at 20080, +$700") and Claude logs them, with duplicate detection against MT5.
Starts automatically at login (macOS) and syncs in the background.
Demo mode with 200+ realistic trades, so you can try everything before connecting a live account.
Accurate maths: deals are grouped per MT5 position, partial closes are volume-weighted, netting reversals are split, broker server time (incl. New York-close DST) is converted to your timezone, and balances are reconciled against MT5.
How it works
flowchart LR
MT5["MetaTrader 5<br/>+ TradeJournalSync EA<br/>(read-only)"] -- "JSON / CSV files<br/>every new deal" --> J["Journal engine<br/>(Python · SQLite)"]
J --> UI["Web app<br/>localhost:8000"]
J <--> MCP["MCP server"]
MCP <--> C["Claude Desktop /<br/>Claude Code"]
You(("You")) --> UI
You -- "voice or text" --> CThe EA runs on any MT5 chart. It never places, changes or closes trades. It writes your account, deals, symbols, open positions and price excursions to MT5's shared
Common/Files/TradeJournal/folder.The journal watches that folder, rebuilds trades from deals, and computes the statistics, behaviour flags and insights.
The web app shows it all. The MCP server gives Claude 16 tools to read the journal, add notes, log trades and save reviews.
Quick start
You need:
uv, which installs Python 3.13 for you
MetaTrader 5
Claude Desktop for AI coaching (optional; it uses your Claude subscription, no API key)
git clone https://github.com/gillani-hello/ai-trading-journal.git
cd ai-trading-journal
uv sync # Python dependencies
cd web && npm install && npm run build && cd .. # web app
uv run tj serve # → http://127.0.0.1:8000Try it first with demo data (kept separate from your real journal):
uv run tj seed-demo
uv run tj serve --demo1. Connect MetaTrader 5
uv run tj install-eaThis copies mt5/TradeJournalSync.mq5 into your terminal's MQL5/Experts/TradeJournal/ folder and compiles it with your MetaEditor. Then, in MT5:
Open Navigator › Expert Advisors › TradeJournal, find TradeJournalSync, and drag it onto any one chart. Click OK.
Leave that chart open. Your full history is imported straight away, and new trades arrive within seconds.
The EA contains no trading code, so Algo Trading can stay off. If your terminal won't start EAs at all, tick Allow Algo Trading in its properties. If install-ea can't find or compile it, do it by hand: in MT5 choose File › Open Data Folder, put the .mq5 file into MQL5/Experts/, open it in MetaEditor and press F7.
Platform | Status |
macOS (MetaQuotes' MT5 app for Mac) | ✅ Tested end to end, including automatic EA compile and start at login |
Windows | ✅ Supported (MT5 under |
Linux (MT5 under Wine: | ✅ Supported. Please report issues |
Folders are found automatically. Set TJ_MT5_DIR to the EA's export folder to override that.
2. Keep it running (optional, macOS)
uv run tj install-service # start at login, restart if it crashes
uv run tj uninstall-service # undoOn Windows, install-service prints a ready-to-run schtasks command; on Linux it prints the command to use in a systemd user service.
AI coaching with Claude
The coach runs inside Claude Desktop or Claude Code on your own Claude plan, with no API key and no extra cost. Claude talks to the journal through the Model Context Protocol (MCP).
Connect (one time)
uv run tj mcp-config --write-desktop # adds the journal to Claude Desktop (backs up your config)Then quit Claude Desktop completely (⌘Q / Exit) and reopen it. Ask "How many trades are in my journal?" to check, and choose Always allow when Claude asks to use the trading-journal tools.
Claude Code: run the claude mcp add … command that uv run tj mcp-config prints.
Talk to your journal
You say | Claude does |
"My last gold trade was a breakout. I felt FOMO and entered late. 2/5." | Adds setup, emotion, mistake and rating to the MT5 trade ( |
"Log a trade from my other broker: short NAS100 at 20150, out at 20080, 1 lot, +$700." | Logs a manual trade and warns about duplicates ( |
"How am I doing on EURUSD this month by session?" | Pulls stats and breakdowns ( |
"What's my worst habit and what is it costing me?" | Reads the behaviour flags with their cost ( |
"Today's review: stopped after two losses like my plan says. Mood calm." | Saves the day's note on the calendar ( |
"Save my trading rules: max 1% risk, stop on every order, no gold in Asia." | Stores your rules; every review then checks you against them |
Speak instead of typing with Claude Desktop's voice input or your OS dictation.
Coaching reviews (prompts)
In Claude Desktop click + › trading-journal and pick a prompt. In Claude Code type /mcp__trading-journal__weekly_review. Or just ask: "Do my weekly trading review."
Prompt | What you get |
| Every instrument you traded: what works, what leaks money, rules to adopt, and a 3–5 point action plan. Progress is checked against the previous review. |
| A 90-day deep dive on one symbol (e.g. XAUUSD) |
| A critique of one trade (entry, stop, exit, size), attached to the trade |
| A guided session for dictating several trades |
Reviews are saved to the AI Coach page, and each instrument's section also appears on that instrument's page. Claude works from numbers the journal computes deterministically (win rate, R, sessions, flags, your notes), so its advice is grounded in your own data.
log_trade · annotate_trade · find_trades · get_trade · get_performance · get_instrument_breakdown · get_calendar · get_behavior_report · get_coaching_context · save_ai_report · save_trade_feedback · write_day_note · list_tags · set_trading_rules · sync_mt5 · delete_trade
The AI coach reviews your process and discipline from your own statistics. It does not give investment advice or tell you which trades to take.
Commands
Command | Purpose |
| Web app + MT5 folder watcher |
| MCP server on stdio (Claude launches this) |
| Import now; |
| Copy + compile the MT5 Expert Advisor |
| Connect Claude Desktop / Claude Code |
| Start at login (macOS) |
| Rebuild the demo journal in |
Settings worth checking
Display timezone: the calendar groups trades by close time in this zone.
Broker server time: Auto handles "New York close" brokers (UTC+2 in winter, UTC+3 in summer). Choose Fixed if your broker's clock never changes.
Sessions: defined in UTC hours.
Revenge window, max trades per day, early-exit threshold: these tune the red flags.
My trading rules: Claude holds you to these in every review.
Your data lives in data/journal.db (SQLite) and data/screenshots/. Back up that folder and you've backed up your journal.
FAQ
Yes. It's MIT-licensed open source, with no subscription, trial or paywall. The AI coach uses the Claude plan you already have.
Yes. The EA reads the terminal's own account history, so it works with any broker or prop-firm account you can open in MetaTrader 5, on demo, live or challenge accounts. Hedging and netting accounts are both supported.
No. It only reads history and writes files to MT5's shared folder. The source is in mt5/TradeJournalSync.mq5.
Not yet. The EA is written in MQL5. An MQL4 version is on the roadmap, and contributions are welcome.
Everything stays on your computer in a local SQLite database. Nothing is uploaded. When you use the AI coach, Claude reads the journal through the local MCP server, on your own Claude account.
No. It works through Claude Desktop or Claude Code on your normal Claude plan.
Yes. Use "Log trade" in the web app, or just tell Claude about the trade.
That's the goal: an open-source trading journal you run yourself. It offers automatic MT5 import, a P&L calendar, a per-trade journal with screenshots, analytics and an AI coach, without a monthly fee.
Roadmap
MetaTrader 4 (MQL4) export EA
Light theme
CSV import from other platforms
Multi-currency account totals
Docker image
Ideas and pull requests are very welcome. See CONTRIBUTING.md.
Support the project
If this journal helps your trading, you can support its development with crypto ❤️
Asset | Network | Address |
USDT | Ethereum (ERC-20) |
|
USDT | Tron (TRC-20) |
|
ETH | Ethereum (ERC-20) |
|
Always double-check the network before sending: ERC-20 and TRC-20 are different networks. A ⭐ on GitHub also helps other traders find the project.
Contributing
Bug reports, feature ideas and pull requests are welcome. See CONTRIBUTING.md for the development setup (uv run pytest, npm run dev).
License and disclaimer
MIT © Syed Muhammad Ali Hassan Gillani.
This software is for journaling and education only. It is not financial advice, and trading carries a high risk of loss. MetaTrader is a trademark of MetaQuotes Ltd; Claude is a trademark of Anthropic. This project isn't affiliated with either.
Keywords: trading journal, MT5 trading journal, MetaTrader 5 journal, free trading journal, open source trading journal, forex trading journal, gold XAUUSD journal, trade log, trading diary, trading performance analytics, AI trading coach, Claude MCP, prop firm journal.
Available Tools
16 toolsannotate_tradeC
Add journal details (setup, emotions, mistakes, notes, rating) to a trade, usually one synced from MT5.
Inputs: notes, setup, trade, rating, +7 more. Returns: object
delete_tradeB
Delete a manually logged trade (MT5 trades can't be deleted; they come back on sync).
Inputs: trade_id (required). Returns: object
find_tradesC
Search trades. Returns a compact list plus the total count.
Inputs: sort, limit, setup, period, +9 more. Returns: object
get_behavior_reportB
Behavioural red flags (revenge trading, overtrading, no/widened stops, early exits, sizing up after losses...) with cost.
Inputs: period, symbol, date_to, date_from. Returns: object
get_calendarB
Daily P&L for a month (trading days only), weekly totals and the month summary.
Inputs: month. Returns: object
get_coaching_contextA
Everything needed for a coaching review in one call: stats vs previous period, per-instrument verdicts and insights, breakdowns, behaviour flags, best/worst trades, journal notes, day notes, the user's trading rules and the previous report's action plan.
Inputs: period, symbol, date_to, date_from. Returns: object
get_instrument_breakdownC
Per-instrument stats, verdict (edge/leaking/breakeven/unproven), best/worst sessions, insights and red flags.
Inputs: period, date_to, date_from. Returns: object
get_performanceC
Win rate, P&L, profit factor, expectancy, R, drawdown, streaks — optionally broken down by dimension.
Inputs: period, symbol, date_to, group_by, +1 more. Returns: object
get_tradeA
Full detail of one trade: prices, costs, R, MFE/MAE, deals, journal, and any behaviour flags it triggered.
Inputs: trade_id (required). Returns: object
list_tagsA
The user's setup, emotion and mistake vocabularies. Reuse these names when tagging.
Inputs: no named parameters. Returns: object
log_tradeA
Log a trade the user dictates that is NOT in MT5 (other broker, or not synced). Returns the trade and warnings.
Inputs: symbol (required), direction (required), entry_price (required), pnl, +13 more. Returns: object
save_ai_reportA
Save a coaching review so it shows in the web app (AI Coach page and each instrument's page). Every claim should be backed by numbers from the journal.
Inputs: report (required). Returns: object
save_trade_feedbackB
Attach AI feedback to a single trade (shown on the trade's page).
Inputs: feedback (required), trade_id (required). Returns: object
set_trading_rulesB
Save the user's written trading rules; coaching reviews check behaviour against them.
Inputs: rules (required). Returns: object
sync_mt5B
Pull the latest trades from MT5 right now.
Inputs: force. Returns: object
write_day_noteB
Save the pre-session plan or post-session review for a day (text is appended to what is there).
Inputs: day, mood, rules_followed, pre_session_plan, +1 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have clearly distinct resource+action targets: logging vs annotating vs deleting a trade, note writing, searching, single-trade detail, and various reporting dimensions. The main overlap is get_coaching_context, which bundles data also available via get_performance, get_instrument_breakdown, and get_behavior_report, so an agent might wonder when to use the bundle versus the individual reports. save_ai_report vs save_trade_feedback is also a mild boundary that descriptions mostly resolve (report vs per-trade feedback).
All names follow a consistent snake_case verb_noun pattern (log_trade, annotate_trade, delete_trade, get_performance, save_ai_report, sync_mt5, etc.). Verb choice is predictable and domain-appropriate, with no mixed conventions or cryptic abbreviations.
16 tools is slightly above the ideal 3-15 range but each appears to earn its place: core CRUD on trades, journaling, tagging, rules, and several targeted analytics views. The set is well-scoped for a trading journal rather than padded with redundant operations.
Core lifecycle is well covered: log/annotate/delete trades, sync MT5, day notes, rules, search/detail, and rich analytics plus coaching reports. Minor gaps exist: no way to edit a manually logged trade's core fields (only annotate or delete), no tag creation/management beyond list_tags, and no update operation for day notes or trading rules beyond overwrite/append.
Maintenance
Related MCP Connectors
MCP for Tradewink trading signals and watchlists. Not financial advice.
Trading journal with pattern detection: log trades by voice, query your own history.
Trading journal in Obsidian. Ask Claude or ChatGPT about your trades; edits are previewed first.
AI trading partner and trading journal: trades, reports, journaling, market data.
Related MCP Servers
- ISC
- AlicenseNot gradedqualityCmaintenanceProvides AI-powered trading analytics and coaching by analyzing historical trades to identify strategies, emotional patterns, and behavioral mistakes via MCP tools.1MIT
- AlicenseAqualityDmaintenanceOfficial MCP Server for Indian Stock Market (NSE & BSE) equities, futures context, and option chains.6MIT
- AlicenseNot gradedqualityBmaintenanceProvides market intelligence tools for crypto, Korean market, US equities, options, and backtests, as well as personal trading journal access, through MCP.30 PyPIMIT