---
name: EA Performance Monitoring System
description: Automated trading EA monitoring system with backtest/OOS/live comparison, interactive HTML reports, batch backtesting automation, and email alerts
type: project
---

## System Overview
Full-stack EA performance monitoring system at `C:\Trading\MonitoringSystem\` with batch OOS backtesting at `C:\Trading\OOS_Automation\`.

**Why:** User runs ~25 algorithmic trading EAs on MetaTrader 5 across multiple brokers (FTMO at 2x risk, DarwinexZero at 1x). Needs automated drift detection comparing live performance against backtest and OOS baselines.

**How to apply:** All work on this project should reference CLAUDE.md at `C:\Trading\MonitoringSystem\CLAUDE.md` for full architecture, commands, directory structure, and known issues.

## Key Components
1. SQLite database with 4 tables: live_trades, backtest_baselines, oos_baselines, backtest_correlations
2. MQL5 TradeExporter EA running on FTMO terminal, exports closed trades to CSV hourly
3. Python importers for backtest (Quant Analyzer CSVs), OOS, and live trade data
4. Interactive HTML report with CoinGlass dark theme, client-side JS filtering, Plotly charts
5. Email delivery via Gmail (XCPS313@gmail.com → m.kamran237@gmail.com)
6. Windows Task Scheduler: weekly (Sunday 20:00) and monthly (1st, 20:00)
7. Batch OOS backtesting using portable MT5 at `C:\Trading\MT5_Backtester\`

## MT5 Automation Gotcha
MT5 `/config:` does NOT reliably set Period or ExpertParameters on non-portable installations. Internal caching overrides config files. Solution: dedicated portable MT5 copy with `.set` files in optimizer format (`value||value||0||0||N`), cache clearing before each test, and post-test parameter validation.

## Tech Constraints
- Python 3.15 alpha — no pandas (no prebuilt wheels). All data processing uses stdlib `csv` + `sqlite3`.
- Plotly and Jinja2 are installed. Tailwind CSS via CDN.
- All MT5 files (.tpl, .set, HTML reports) are UTF-16 encoded.
