diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index c916106..811ff2c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -4357,20 +4357,35 @@ See `POSITION_SCALING_ROADMAP.md` for planned position management optimizations: - SQL queries in `docs/analysis/SIGNAL_QUALITY_VERSION_ANALYSIS.sql` for deep-dive analysis - Need 20+ trades per version before meaningful comparison -**Indicator Version Tracking (Nov 18-22, 2025):** Database tracks `indicatorVersion` field for TradingView strategy comparison: -- **v8:** Money Line Sticky Trend (Nov 18+) - **PRODUCTION SYSTEM** - - Flip threshold: 0.6% (price must breach line by 0.6% before signal change) - - Momentum confirmation: Tracks consecutive bars beyond threshold (anti-whipsaw) - - Entry buffer: 0.2 ATR (filters wick flips), ADX minimum: 18, Quality threshold: 91 - - **Perfect quality separation validated:** ≥95 = 100% wins (4/4), ≤90 = 0% wins (0/3) - - 8 trades completed (57.1% WR, +$262.70), collecting data for 50+ trade statistical validation - - File: `workflows/trading/moneyline_v8_sticky_trend.pinescript` +**Indicator Version Tracking (Nov 18-26, 2025):** Database tracks `indicatorVersion` field for TradingView strategy comparison: +- **v9:** Money Line with Momentum-Based SHORT Filter (Nov 26+) - **PRODUCTION SYSTEM** + - Built on v8 foundation (0.6% flip threshold, momentum confirmation, anti-whipsaw) + - **MA Gap Analysis:** +5 to +15 quality points based on MA50-MA200 convergence + - **Momentum-Based SHORT Filter (Nov 26, 2025 - CRITICAL ENHANCEMENT):** + * **REMOVED:** RSI filter for SHORTs (data showed RSI 50+ has BEST 68.2% WR) + * **ADDED:** ADX ≥23 requirement (filters weak chop like ADX 20.7 failure) + * **ADDED:** Price Position ≥60% (catches tops) OR ≤40% with Vol ≥2.0x (capitulation) + * **Rationale:** v8 shorted oversold (RSI 25-35), v9 shorts momentum at tops + * **Blocks:** Weak chop at range bottom (today's -$153.98 disaster would be blocked) + * **Catches:** Massive downtrends from top of range (user's chart examples) + - **Data Evidence (95 SHORT trades analyzed):** + * RSI < 35: 37.5% WR, -$655.23 (4 biggest disasters) + * RSI 50+: 68.2% WR, +$29.88 (BEST performance!) + * Winners: ADX 23.7-26.9, Price Pos 19-64% + * Losers: ADX 21.8-25.4, Price Pos 13.6% (today) + - **First Day Results (Nov 26, 2025):** 2 losses, -$287.29 total (both would be blocked by momentum filter) + - **Quality threshold:** LONG ≥90, SHORT ≥95 (direction-specific) + - File: `workflows/trading/moneyline_v9_ma_gap.pinescript` + momentum filter in `lib/trading/signal-quality.ts` +- **v8:** Money Line Sticky Trend (Nov 18-26) - ARCHIVED + - 8 trades completed (57.1% WR, +$262.70) + - **Failure pattern:** 5 oversold SHORT disasters (RSI 25-35), 1 weak chop (ADX 20.7) + - Purpose: Baseline for v9 momentum improvements - **ARCHIVED (historical baseline for comparison):** - - **v5:** Buy/Sell Signal strategy (pre-Nov 12) - 36.4% WR, +$25.47 - ARCHIVED - - **v6:** HalfTrend + BarColor (Nov 12-18) - 48% WR, -$47.70 - ARCHIVED - - **v7:** v6 with toggles (deprecated - minimal data, no improvements) - ARCHIVED -- **Purpose:** v8 is production, archived versions provide baseline for future v9 development -- **Analytics UI:** v8 highlighted, archived versions greyed out but kept for statistical reference + - **v5:** Buy/Sell Signal strategy (pre-Nov 12) - 36.4% WR, +$25.47 + - **v6:** HalfTrend + BarColor (Nov 12-18) - 48% WR, -$47.70 + - **v7:** v6 with toggles (deprecated - minimal data, no improvements) +- **Purpose:** v9 is production, archived versions provide baseline for future enhancements +- **Analytics UI:** v9 highlighted, archived versions greyed out but kept for statistical reference **Financial Roadmap Integration:** All technical improvements must align with current phase objectives (see top of document): @@ -4548,6 +4563,45 @@ const tracker = new StopHuntTracker() // ❌ Don't do this - Missed +$490 potential profit if not stopped - Revenge system would've re-entered SHORT at ~$141.50 with same size, captured full reversal move +**Revenge Timing Enhancement - 90s Confirmation (Nov 26, 2025):** +- **Problem Identified:** Immediate entry at reversal price caused retest stop-outs +- **Real Incident (Nov 26, 14:51 CET):** + * LONG stopped at $138.00, quality 105 + * Price dropped to $136.32 (would trigger immediate revenge) + * Retest bounce to $137.50 (would stop out again at $137.96) + * Actual move: $136 → $144.50 (+$530 opportunity MISSED) +- **Root Cause:** Entry at candle close = top of move, natural 1-1.5% pullbacks common +- **OLD System:** + * LONG: Enter immediately when price < entry + * SHORT: Enter immediately when price > entry + * Result: Retest wicks stop out before real move +- **NEW System (Option 2 - 90s Confirmation):** + * **LONG:** Require price below entry for 90 seconds (1.5 minutes) before entry + * **SHORT:** Require price above entry for 90 seconds (1.5 minutes) before entry + * Tracks `firstCrossTime`, resets if price leaves zone + * Logs progress: "⏱️ LONG/SHORT revenge: X.Xmin in zone (need 1.5min)" + * **Rationale:** Fast enough to catch moves (not full 5min candle), slow enough to filter retest wicks +- **Implementation Details:** + ```typescript + // lib/trading/stop-hunt-tracker.ts (lines 254-310) + // LONG revenge: + if (timeInZone >= 90000) { // 90 seconds = 1.5 minutes + console.log(`✅ LONG revenge: Price held below entry for ${(timeInZone/60000).toFixed(1)}min, confirmed!`) + return true + } + + // SHORT revenge: + if (timeInZone >= 90000) { // 90 seconds = 1.5 minutes + console.log(`✅ SHORT revenge: Price held above entry for ${(timeInZone/60000).toFixed(1)}min, confirmed!`) + return true + } + ``` +- **User Insight:** "i think atr bands are no good for this kind of stuff" - ATR measures volatility, not support/resistance +- **Future Consideration:** TradingView signals every 1 minute for better granularity (pending validation) +- **Git Commit:** 40ddac5 "feat: Revenge timing Option 2 - 90s confirmation (DEPLOYED)" +- **Deployed:** Nov 26, 2025 20:52:55 CET +- **Status:** ✅ DEPLOYED and VERIFIED in production + **Deployment Status:** - ✅ Database schema created (StopHunt table with indexes) - ✅ Tracker service implemented (293 lines, 8 methods)