From 4f6a4b76cf4416e60435c4df8ba679efe0e0fc29 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Sun, 23 Nov 2025 15:10:34 +0100 Subject: [PATCH] docs: Document direction-specific quality thresholds in copilot instructions Architecture Overview Updates: - Updated Signal Quality System section with direction-specific thresholds - Added detailed subsection explaining Nov 23, 2025 implementation - Data-driven rationale: 227 trades analysis showed $778.52 P&L gap - Configuration: LONG=90 (71.4% WR), SHORT=95 (28.6% WR toxic) - Helper function, fallback logic, and expected impact documented - Reference to complete analysis in docs/DIRECTION_SPECIFIC_QUALITY_THRESHOLDS.md Context for Future AI Agents: - Why different thresholds: historical data shows clear directional bias - Quality 90-94 longs profitable (+$44.77 on 7 trades) - Quality 90-94 shorts toxic (-$553.76 on 7 trades) - System now captures profitable longs while blocking toxic shorts --- .github/copilot-instructions.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 8abb294..26e259a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -78,7 +78,17 @@ - BTC and other symbols fall back to global settings (`MAX_POSITION_SIZE_USD`, `LEVERAGE`) - **Priority:** Per-symbol ENV → Market config → Global ENV → Defaults -**Signal Quality System:** Filters trades based on 5 metrics (ATR, ADX, RSI, volumeRatio, pricePosition) scored 0-100. Only trades scoring 91+ are executed (raised from 81 on Nov 21, 2025 after trade #7: ADX 19.0 weak-trend loss at quality 90). v8 averaging 93.6 quality with 57.1% win rate - threshold raised to filter borderline ADX entries. Scores stored in database for future optimization. +**Signal Quality System:** Filters trades based on 5 metrics (ATR, ADX, RSI, volumeRatio, pricePosition) scored 0-100. **Direction-specific thresholds (Nov 23, 2025):** LONG signals require 90+ (71.4% WR at 90-94), SHORT signals require 95+ (28.6% WR at 90-94 = toxic). Data from 227 trades showed $778.52 P&L difference favoring longs. Scores stored in database for future optimization. + +**Direction-Specific Quality Thresholds (Nov 23, 2025 - DATA-DRIVEN):** +- **LONG threshold:** 90 (captures profitable quality 90-94 signals: 71.4% WR, +$44.77 on 7 trades) +- **SHORT threshold:** 95 (blocks toxic quality 90-94 signals: 28.6% WR, -$553.76 on 7 trades) +- **Configuration:** `MIN_SIGNAL_QUALITY_SCORE_LONG=90`, `MIN_SIGNAL_QUALITY_SCORE_SHORT=95` in .env +- **Fallback logic:** Direction-specific ENV → Global ENV (91) → Default (60) +- **Helper function:** `getMinQualityScoreForDirection(direction, config)` in config/trading.ts +- **Implementation:** check-risk endpoint uses direction-specific thresholds before execution +- **Expected impact:** ~3.1% more trades (quality 90-94 longs), +$44.77 potential profit, prevent -$553.76 losses +- **See:** `docs/DIRECTION_SPECIFIC_QUALITY_THRESHOLDS.md` for complete analysis and SQL queries **Timeframe-Aware Scoring:** Signal quality thresholds adjust based on timeframe (5min vs daily): - 5min: ADX 12+ trending (vs 18+ for daily), ATR 0.2-0.7% healthy (vs 0.4%+ for daily)