5 Commits

Author SHA1 Message Date
GifariKemal 85161b4965 fix: H1 bias calculate on first loop + add filter config infrastructure
**H1 Bias Fix:**
- Fixed cache check to ensure loop_count=1 always calculates H1 bias
- Changed exception log from DEBUG to WARNING for visibility
- Added log on first calculation (loop==1) in addition to every 4 loops
- Result: H1 bias now correctly calculated from first candle

**Filter Config Infrastructure (WIP):**
- Added FilterConfigManager (src/filter_config.py) for dynamic filter control
- Added data/filter_config.json with 11 entry filters (flash_crash, regime, risk, session, spread, h1_bias, ml_confidence, signal_combination, cooldown, time_filter, market_close)
- Added API endpoints: GET/POST /api/filters/config
- Note: Bot integration pending — requires wrapper around all filter checks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 08:09:01 +07:00
GifariKemal e8355b3f62 feat: add 5 dashboard features — dark mode, trade history, backtests, model insights, alerts
- 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>
2026-02-09 05:46:54 +07:00
GifariKemal 61877480b3 feat: add full dashboard monitoring + FEATURES.md documentation
- Create docs/FEATURES.md with complete feature reference (14 entry
  filters, 12 exit conditions, backtest history, risk modes, session
  rules, auto-trainer, active components table, architecture diagram)

- Extend main_live.py _write_dashboard_status() with 10 new data
  sections: entryFilters, riskMode, cooldown, timeFilter,
  sessionMultiplier, positionDetails, autoTrainer, performance,
  marketClose, h1BiasDetails. Add filter tracking at each checkpoint
  in _trading_iteration() and 7 helper methods.

- Add 9 TypeScript interfaces and extend TradingStatus in trading.ts

- Create BotStatusCard (risk mode, cooldown bar, AUC, uptime, market
  close) and EntryFilterCard (14 filters with pass/block/skip icons)

- Enhance SessionCard (lot multiplier badge + time filter status),
  RiskCard (risk mode badge + total loss progress bar), PositionsCard
  (expandable per-position details with momentum, TP probability)

- Update page.tsx layout: BotStatusCard replaces SettingsCard in Row 2,
  EntryFilterCard added to Row 3 sidebar

- Add API defaults for all new fields

Dashboard now monitors 100% of bot features. Verified: Next.js build
0 errors, bot + API + dashboard all run clean, Docker rebuilt OK.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 13:45:31 +07:00
GifariKemal 214b64945d feat: apply #28B smart breakeven + #31B H1 EMA20 filter, add backtests #26-#32
Live trading optimizations (cumulative: $2,807 net, 81.8% WR, Sharpe 3.97):
- #28B: Smart breakeven locks profit at entry + 0.5x ATR instead of fixed $2
- #31B: H1 Price vs EMA20 filter — BUY only when H1 bullish, SELL only when bearish

Backtests #26-#32 (7 scripts testing sell improvement, regime-aware entry,
confluence scoring, dynamic RR, multi-TF H1, and ML exit optimizer).
Winners: #28B (+$229), #31B (+$343). Failed: #26, #27, #29, #30, #32.

Also includes: web dashboard redesign, Docker setup, startup scripts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 10:33:24 +07:00
GifariKemal 7af9183af3 feat: Smart AI Trading Bot for XAUUSD with ML and SMC
- 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>
2026-02-06 09:01:35 +07:00