A web-based application to analyze your MT4 trades and maintain a trading journal. The system automatically syncs trades from your MT4 terminal via an Expert Advisor and Python bridge.
- Dashboard: View portfolio statistics, equity curve, daily performance, and performance by symbol
- Trade History: Browse all synced trades with filtering by account, status, and symbol
- Trading Journal: Document your trades with emotions, lessons learned, and mistakes
- Multi-Account Support: Connect multiple MT4 accounts
- Automatic Sync: EA + Bridge automatically syncs trades every 30 seconds
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MT4 Terminal │ writes JSON │ Python Bridge │ HTTP POST │ Backend API │
│ (Expert Advisor)│ ───────────────> │ (sync_bridge.py)│ ─────────────────> │ (Node/Express) │
└─────────────────┘ to file └─────────────────┘ └────────┬────────┘
│
┌─────────────────┐ ┌────────▼────────┐
│ Web Frontend │ <───────────────── │ SQLite DB │
│ (React) │ └─────────────────┘
└─────────────────┘
Why a bridge? MT4's WebRequest() cannot connect to localhost and has strict HTTPS requirements. The file-based bridge solves this reliably.
# Install root dependencies
npm install
# Install client dependencies
cd client && npm install && cd ..# Start both backend and frontend
npm run devOr run them separately:
# Terminal 1 - Backend API (port 3001)
npm run server
# Terminal 2 - Frontend (port 5173)
npm run clientOpen http://localhost:5173 in your browser.
- Go to Accounts tab
- Click Add Account
- Enter your MT4 account details
- Copy the generated API Key
-
Copy
MT4_EA/TradeSyncFile.mq4to your MT4Expertsfolder:- In MT4:
File→Open Data Folder→MQL4→Experts - Copy the file there
- In MT4:
-
Open MetaEditor and compile the EA (F7)
-
Attach the EA to any chart:
- Drag
TradeSyncFilefrom Navigator to a chart - Enter your API Key in the settings
- Click OK
- Drag
-
The EA will write trade data to:
MQL4/Files/TradeSync/
The bridge reads files from MT4 and sends them to the dashboard.
# Install Python dependencies
cd bridge
pip install -r requirements.txt
# Find your MT4 data folder:
# In MT4: File -> Open Data Folder -> MQL4 -> Files -> TradeSync
# Copy that path
# Run the bridge
python sync_bridge.py --mt4-folder "C:/Users/YOU/AppData/Roaming/MetaQuotes/Terminal/XXXX/MQL4/Files/TradeSync"The bridge will watch for new data and sync to the dashboard automatically.
| Parameter | Default | Description |
|---|---|---|
| ServerURL | http://localhost:3001/api/sync | Your backend API URL |
| ApiKey | (empty) | API key from the web app |
| SyncIntervalSeconds | 30 | How often to sync trades |
| SyncOpenTrades | true | Sync currently open trades |
| SyncClosedTrades | true | Sync trade history |
| HistoryDays | 30 | Days of history to sync |
GET /api/accounts- List all accountsPOST /api/accounts- Create accountDELETE /api/accounts/:id- Delete account
GET /api/trades- List trades (with filters)GET /api/trades/:id- Get single trade
GET /api/journal- List journal entriesPOST /api/journal- Create entryPUT /api/journal/:id- Update entryDELETE /api/journal/:id- Delete entry
GET /api/analytics/portfolio- Portfolio statisticsGET /api/analytics/by-symbol- Performance by symbolGET /api/analytics/equity-curve- Equity curve dataGET /api/analytics/daily- Daily performance
POST /api/sync- Receive trades from MT4 EA
Trade Analysis/
├── client/ # React frontend
│ ├── src/
│ │ ├── App.jsx # Main application
│ │ ├── api.js # API client
│ │ └── index.css # TailwindCSS
│ └── package.json
├── server/
│ └── index.js # Express API server
├── data/
│ └── trades.db # SQLite database (auto-created)
├── MT4_EA/
│ └── TradeSync.mq4 # MT4 Expert Advisor
├── package.json
└── README.md
For production deployment:
- Backend: Deploy to any Node.js hosting (Railway, Render, DigitalOcean, etc.)
- Frontend: Build with
npm run buildand deploy to Netlify, Vercel, etc. - Update EA: Change
ServerURLto your production API URL - HTTPS: Use HTTPS for production (required for MT4 WebRequest)
- Check if "Allow WebRequest" is enabled in MT4
- Verify the server URL is in the allowed list
- Check the MT4 Experts tab for error messages
- Ensure the API key is correct
- Wait for the sync interval (default 30 seconds)
- Check the server console for errors
- Verify the account exists in the web app
Add your server URL to MT4's allowed URLs:
Tools → Options → Expert Advisors → Add URL
MIT