Commit Graph

6 Commits

Author SHA1 Message Date
harwinder 08d7c9ade1 Optimize EUR/USD to 78.7% WR on 2-year M15 backtest
Three-layer optimization:

1. Entry filters (signal_aggregator.py section 6e):
   - Block ranging regime
   - Only A+/A/B quality grades
   - min_entry_score=38, min_entry_confidence=60
   - Block RSI > 70 for BUY, RSI < 30 for SELL

2. Trade setup (config.py EurUsdStrategyConfig):
   - RR=0.50 with uniform quality scale
   - SL floor 1.2 ATR, TP 1.0 ATR

3. Breakeven trail (backtest/gpu_backtest.py):
   - When MFE reaches 0.3R, move SL to entry + 0.05R buffer
   - Converts 4 of 14 losses to +0.05R small wins
   - Bar-by-bar simulation integrated into simulate_trades()

Results (EUR/USD M15, 2024-05-18 to 2026-05-18):
  47 trades | 78.7% WR | +1.81R | PF 1.18 | MaxDD 3.35R
XAU/USD unchanged: 77.8% WR on 30-day, 68.7% WR on 2-year.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-18 14:00:59 -04:00
harwinder 74b723ba06 Tune EUR/USD trade setup: quality-scaled TP and tighter SL
EUR/USD A-grade signals had inverted quality curve (-1.65R) because all
trades got RR≈0.50 and mature_move logic penalized high-score entries.

Fix: add per-pair trade setup params (sl_atr_floor=1.2, min_rr=1.0,
mature_move_threshold=35) and apply quality_scale to both tp_mult and
min_rr so A-grade gets wider TP targets. Also wire EUR config into
backtest via PAIR_PRODUCERS registry.

Result: A-grade now +1.24R (was -1.65R), total EUR/USD +10.06R (was +4.20R).
XAU/USD unchanged at +13.01R.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-18 12:56:34 -04:00
harwinder 0e6f5d74a7 Add backtest scripts to version control
Track gpu_backtest.py, diagnose_filters.py, and instructions.
Data files (CSVs, parquet cache) remain gitignored.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-15 19:49:30 -04:00
harwinder 98daf71a52 Add web dashboard (Redis + FastAPI + WebSocket), scope XAU penalties
Signal daemon (signal_web.py): candle-boundary scanner mirroring
telegram_bot.py, publishes serialized SignalReport JSON to Redis.
Web API (web/app.py): thin FastAPI reader behind Apache, serves
/api/signals REST + /ws WebSocket from Redis pub/sub.
Frontend (web/static/index.html): 3-pair grid, color-coded signals,
indicator breakdown per timeframe, trade setup display.

Also: XAU-specific penalty scoping in signal_aggregator (softer
confidence penalties for gold, original strict values for forex),
pair-aware session filter routing XAU to its own blocked hours.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-14 23:15:37 -04:00
harwinder 235241f95a Harden Telegram bot, add EUR/GBP strategies, parallelize scans
Telegram reliability: rate-limited sends (1 msg/s), dashboard lock,
WebSocket JSON/price error handling, markdown escaping, level cache
TTL, cooldown cleanup, breach task tracking, graceful shutdown.

Telegram speed: parallelize 3-pair scans with asyncio.gather(),
increase thread pool 2→4, parallelize boot-up initial scan.

Strategy: add EUR/USD and GBP/USD pullback-buy strategies with
per-pair configs, optimize XAU TP to 0.9×ATR, block hours 8/9
for XAU and hour 17 for GBP.

Backtest: add --max-hours flag to evaluate.py for time-exit support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-13 21:07:49 -04:00
harwinder 1e5047e20f Backtest tuning, data freshness guard, Telegram improvements
- Drop USD/JPY from scan pairs (zero signals across all timeframes)
- Disable divergence indicator (zero impact in 14-config lab test)
- Parallelize evaluate.py with ProcessPoolExecutor (16 cores)
- Add --pair CLI filter to evaluate.py for single-pair backtests
- Add data freshness guard: stale cache auto-invalidated, primary TF
  stale data suppresses signals to prevent trading on old data
- Add /cache command: shows fetch age and last bar per pair/TF
- Add /clearcache command: wipes in-memory cache for fresh API fetch
- Remove BB from WebSocket breach alerts (keep structural levels only)
- Show live prices only for WS-monitored pairs (EUR/USD, XAU/USD)
- Replace arrow emojis with text tags in indicator lines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-12 22:56:55 -04:00