Add M1+M15 multi-timeframe SMC scalping training pipeline (GPU XGBoost),
then fix data-leakage and non-stationarity issues found in a skeptical audit.
Pipeline:
- src/triple_barrier.py: TP/SL/time labeling (ATR-scaled, asymmetric RR)
- src/multi_tf_dataset.py: M1 base + M15 HTF context, point-in-time join_asof
(only CLOSED M15 candles visible to each M1 bar - proven no leakage)
- src/economic_calendar.py: point-in-time forecast/actual/surprise provider
- src/smc_polars.py: add premium/discount + displacement SMC features
- scripts/train_multitf_scalper.py: GPU (device=cuda) training + walk-forward
- scripts/download_training_data.py: 1y data downloader
Leakage / robustness fixes (audit):
- CRITICAL: order block signal was written to the ORIGIN bar (future info);
now assigned at the CONFIRMATION bar -> matches live conditions
- replace non-stationary absolute features (ema_9/21, macd*) with scale-free
forms (ema*_dist_atr, ema_spread_atr, macd_*_bps) -> valid at any price level
- drop constant-zero calendar features from defaults (recurring provider has
no real values); re-add when a real calendar CSV is configured
- walk-forward + train/test now embargo the max_holding label horizon and drop
warmup rows (NaN->0 artifacts)
- news calendar features remain point-in-time (actual only at/after release)
Honest result: after fixes the spurious +2.35% edge collapses to ~random
(AUC 0.49). The prior edge was caused by the order-block look-ahead. Pipeline
is now leakage-free; a real edge still needs more M1 history / better features.
Also: test infra (pytest.ini asyncio, hmmlearn), TRAIN_BARS, cleanup of dead
modules. 14 tests pass.
Make the bot connect to MetaTrader5 on Linux without manual setup or
launching extra programs.
- Add mt5linux rpyc bridge: MT5 terminal + Windows Python run under Wine,
Linux client talks to it over a socket
- scripts/mt5_bridge.sh: robust, idempotent launcher (up/down/status/restart/
login-gui/install-service) with .env loading, port health-checks and a
systemd --user unit for auto-start on login
- src/mt5_connector.py: auto-detect bridge backend (lazy, non-blocking import);
auto-start the bridge via mt5_bridge.sh when the port is down so the bot
self-connects; attach-mode initialize() first, then explicit login
- Use configured SYMBOL instead of hardcoded XAUUSD in connector + news_agent
(XM names spot gold 'GOLD')
- scripts/test_mt5_bridge.py: connectivity smoke test
- docs/MT5-ARCH-LINUX-SETUP.md: full setup, root-cause notes, troubleshooting
Verified live: account 345454551 @ XMGlobal-MT5 10, balance read, GOLD M15
data + ticks streaming, trade_allowed=True.
Added profit momentum feature research files from previous analysis:
- docs/research/PROFIT_MOMENTUM_CODE_SNIPPET.py — Implementation code
- docs/research/PROFIT_MOMENTUM_INTEGRATION.md — Integration guide
- tests/test_profit_momentum.py — Test script
These files document profit momentum feature exploration (unrelated to
current HMM fix but kept for reference).
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Dark mode: class-based theme toggle with localStorage persistence and flash prevention
- Trade History (/trades): paginated table, stats cards, equity curve chart with DB API endpoints
- Backtest Viewer (/backtests): log parser for 35 backtest results, sidebar + detail + comparison tabs
- Model Insights: dashboard card + dialog showing feature importance, regime distribution, training history
- Alert/Signal Log (/alerts): signal stats, filterable table with execution tracking
- API: 8 new endpoints with psycopg2 DB connection pool
- Dark mode sweep across books page, about dialog, and all dashboard components
- Architecture docs rewritten with Mermaid diagrams (23 docs)
- README and FEATURES.md rewritten bilingual (Indonesian + English)
- main_live.py: write model_metrics.json on startup and retrain
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move utility scripts to scripts/ (check_market, check_positions, etc.)
- Move test files to tests/ (test_modules, test_mt5_connection, etc.)
- Move deprecated dashboards to archive/
- Move research files to docs/research/
- Add sys.path fix to all moved Python files
- Rewrite README.md with architecture diagram and badges
- Add CLAUDE.md project guide
- Add MIT LICENSE
- Update .gitignore with archive/ pattern
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Loop: ~1 detik → candle-based (M15) + position check ~10 detik
- Exit Kondisi 3: Golden Time Hold → Early Cut (Smart Hold dihapus)
- AUC rollback threshold: 0.52 → 0.60
- Train/test: tambah 50-bar gap info
- Timer periodik: candle-based intervals
- Performance: split full analysis vs position-check-only
- Golden Time: hapus referensi hold losers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add model backups from training sessions
- Add training data parquet file
- Add risk state persistence file
- Add research documents (Gemini analysis)
- Update architecture docs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- XGBoost ML model with 37 features for market direction prediction
- Smart Money Concepts (SMC): Order Blocks, FVG, BOS, CHoCH
- HMM market regime detection (trending/ranging/volatile)
- ATR-based stop loss with 1.5 ATR minimum distance
- Broker-level SL protection with fallback
- Time-based exit (max 6 hours per trade)
- Session-aware trading optimized for London/NY overlap
- Auto-retraining based on market conditions
- Telegram notifications and web dashboard
- Backtest results: 63.9% win rate, 2.64 profit factor, 4.83 Sharpe
Backtest period: Jan 2025 - Feb 2026, 654 trades, $4,189 net P/L
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>