From cfed9573216f00c4b9b55a52bdcadb21d0334e55 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Fri, 14 Nov 2025 06:48:42 +0100 Subject: [PATCH] docs: add Phase 6 (range compression) and Phase 7 (volume profile) to roadmap Added two new optimization phases for future implementation: PHASE 6: TradingView Range Compression Metrics (PLANNED) - Target: November 2025 (after frequency penalties validated) - Adds range%, priceChange5bars, ADX-momentum mismatch to alerts - Detects fake trends (ADX passes but price not moving) - Penalties: -20 pts for compressed range, -20 pts for momentum mismatch - Implementation: 1-2 hours (TradingView alert modifications) PHASE 7: Volume Profile Integration (ADVANCED) - Target: December 2025 or Q1 2026 - Uses Volume S/R Zones V2 indicator for volume node detection - Identifies high-probability chop zones (price stuck in volume node) - Penalties: -25 to -35 pts for volume node entries - Bonuses: +10 to +15 pts for breakout setups - Implementation: 2-3 hours + Pine Script expertise - Most powerful but also most complex Also documented Phase 1.5 completion (signal frequency penalties). Milestones updated with realistic timelines for each phase. --- SIGNAL_QUALITY_OPTIMIZATION_ROADMAP.md | 226 +++++++++++++++++++++++-- 1 file changed, 211 insertions(+), 15 deletions(-) diff --git a/SIGNAL_QUALITY_OPTIMIZATION_ROADMAP.md b/SIGNAL_QUALITY_OPTIMIZATION_ROADMAP.md index e847d3c..d6f69d4 100644 --- a/SIGNAL_QUALITY_OPTIMIZATION_ROADMAP.md +++ b/SIGNAL_QUALITY_OPTIMIZATION_ROADMAP.md @@ -78,6 +78,56 @@ ORDER BY MIN(signalQualityScore) DESC; --- +## Phase 1.5: Signal Frequency Penalties ✅ DEPLOYED Nov 14, 2025 + +**Status:** Production deployment complete +**Commit:** 111e3ed +**Deployment Time:** 07:28 CET, November 14, 2025 + +### What Was Implemented +Real-time database analysis that detects overtrading and flip-flop patterns before trade execution. + +### Penalties Applied +1. **Overtrading (3+ signals in 30min):** -20 points + - Counts both executed trades AND blocked signals + - Prevents excessive trading in consolidation zones + +2. **Flip-flop (opposite direction <15min):** -25 points + - Blocks rapid long→short→long whipsaws + - Example: SHORT 10:00 → LONG 10:12 = blocked + +3. **Alternating pattern (last 3 trades):** -30 points + - Detects choppy market conditions + - Pattern: long→short→long = chop detection + +### Technical Details +- **Function:** `getRecentSignals()` in `lib/database/trades.ts` +- **Architecture:** `scoreSignalQuality()` now async +- **Endpoints updated:** check-risk, execute, reentry-check +- **Performance:** Indexed queries, <10ms overhead + +### Expected Impact +- Eliminate tight-range flip-flops (Nov 14 chart: $141-145 SOL) +- Reduce overtrading during sideways markets +- Target: +5-10% win rate improvement +- Better capital preservation in chop + +### Monitoring +Watch for penalty messages in logs: +``` +⚠️ Overtrading zone: 3 signals in 30min (-20 pts) +⚠️ Flip-flop detected: opposite direction 12min ago (-25 pts) +⚠️ Chop pattern: last 3 trades alternating (long → short → long) (-30 pts) +``` + +### Validation Plan +1. Monitor next 5-10 signals +2. Verify penalties trigger correctly +3. Analyze if blocked signals would have lost +4. If effective, proceed to Phase 6 (range compression) + +--- + ## Phase 2: Pattern Analysis 🔜 NEXT **Prerequisites:** 10-20 blocked signals collected @@ -258,21 +308,163 @@ Monitoring Job (runs every 30 min) --- -## Phase 5: ML-Based Optimization 🧠 DISTANT FUTURE +## Phase 5: ML-Based Scoring (DISTANT FUTURE) 🤖 -**Goal:** Use machine learning to optimize scoring weights -**Prerequisites:** 200+ trades with quality scores, 100+ blocked signals -**Complexity:** High +**Status:** Future consideration - requires extensive data +**Estimated Start:** Q2 2026 or later +**Prerequisites:** 500+ trades with quality scores, proven manual optimization ### Approach -1. Extract features: ATR, ADX, RSI, volume, price position, timeframe -2. Train model on: executed trades (outcome = P&L) -3. Validate on: blocked signals (if price analysis complete) -4. Generate: Optimal scoring weights for each feature -5. Implement: Dynamic threshold adjustment based on market conditions +1. Build ML model to predict trade success from metrics +2. Use predicted success rate as quality score +3. Continuously learn from new trades +4. Auto-adjust weights based on market regime -### Not Implemented Yet -This is a future consideration only. Current data-driven approach is sufficient. +### Requirements +- Sufficient training data (500+ trades minimum) +- Market regime classification system +- ML infrastructure (model training, deployment) +- Monitoring for model drift + +### Risks +- Overfitting to past data +- Model degrades as markets change +- Black box decision-making +- Increased system complexity + +**Note:** Only pursue if manual optimization plateaus or if pursuing ML as learning exercise. + +--- + +## Phase 6: TradingView Range Compression Metrics (PLANNED) 📏 + +**Status:** Planned - Next after frequency penalties prove effective +**Estimated Start:** November 2025 (after Phase 1 validation) +**Prerequisites:** Phase 1 deployed, 5-10 signals monitored + +### What It Does +Adds NEW metrics to TradingView alerts to detect range compression and momentum mismatches that indicate choppy markets. + +### New TradingView Calculations +```javascript +// 1. Range compression (20-bar high/low range as % of price) +rangePercent = ((highest(high, 20) - lowest(low, 20)) / close) * 100 + +// 2. Price change over 5 bars (momentum check) +priceChange5bars = ((close - close[5]) / close[5]) * 100 + +// 3. ADX-momentum mismatch (ADX says trend but price not moving) +adxMismatch = (adx > 15 AND abs(priceChange5bars) < 0.3) +``` + +### Quality Score Penalties +- **Range < 1.5× ATR**: -20 points (compressed range = chop likely) +- **ADX 15+ but price change < 0.3%**: -20 points (fake trend signal) +- **Price oscillating around MA**: -15 points (whipsaw zone) + +### Why This Helps +Current system can pass ADX 12-22 even when price just bouncing in tight zone. This detects the mismatch between "ADX says trending" vs "price says chopping." + +**Example from Nov 14 chart:** Multiple signals in $141-145 range passed quality check despite obvious consolidation. Range compression would have caught this. + +### Implementation Steps +1. Add calculations to TradingView strategy (30 min) +2. Update webhook JSON to include new fields (15 min) +3. Modify `scoreSignalQuality()` to use range metrics (30 min) +4. Test alerts on historical data (1 hour) +5. Deploy and monitor (ongoing) + +### Expected Impact +- Catch "fake trends" where ADX misleads +- Reduce entries in tight consolidation zones +- Improve win rate by 3-5% in choppy markets +- Complement frequency penalties (Phase 1) + +### Success Metrics +- Reduction in flip-flop losses +- Fewer blocked signals in validated trending moves +- Better P&L in sideways market conditions + +--- + +## Phase 7: Volume Profile Integration (ADVANCED) 📊 + +**Status:** Future consideration - most complex but most powerful +**Estimated Start:** December 2025 or Q1 2026 +**Prerequisites:** Phase 6 completed, Volume S/R Zones V2 indicator expertise + +### What It Does +Uses Volume S/R Zones V2 indicator to detect when price is stuck in high-volume consolidation nodes where flip-flops are most likely. + +### How Volume Profile Works +- Shows horizontal bars representing volume at each price level +- **Volume nodes** (thick bars) = high volume = price gets stuck (S/R zones) +- **Thin zones** (low volume) = price moves through quickly (breakout zones) +- Price bouncing inside volume node = high probability chop + +### Required Indicator Modifications +Expose these values from Volume S/R Zones V2: +```javascript +// New indicator outputs (requires Pine Script modifications) +inVolumeNode: true/false // Is price inside thick volume bar? +nearVolumeEdge: true/false // Near top/bottom of node? (breakout setup) +nodeStrength: 0-100 // Volume concentration at this level +distanceFromNode: % // How far from nearest node? +volumeNodeWidth: % // How wide is current node? (tight = strong) +``` + +### Quality Score Adjustments +**Penalties:** +- **In volume node (stuck)**: -25 points (high chop probability) +- **Node strength > 80**: -30 points (VERY strong S/R = rejection likely) +- **Tight node width (<1%)**: -35 points (extreme consolidation) + +**Bonuses:** +- **Near volume edge + high volume**: +10 points (breakout setup) +- **Distance from node > 2%**: +5 points (free movement zone) +- **Breaking through node with volume**: +15 points (momentum trade) + +### Why This Is Powerful +**Example from Nov 14 chart:** Price bouncing $141-145. Volume profile would show THICK volume node at that exact level - instant warning. System would: +1. Detect price in node → apply -25 to -35 penalty +2. Block most entries in that zone +3. Wait for breakout above/below node +4. Bonus points when price clears node with volume + +### Implementation Complexity +**High - Requires:** +1. Modify Volume S/R Zones indicator source code (Pine Script) +2. Expose new variables in indicator settings +3. Add webhook outputs from indicator (JSON formatting) +4. Parse in n8n workflow (new data structure) +5. Update quality scorer with volume logic (complex conditionals) +6. Test on historical data with indicator overlays +7. Validate against manual chart analysis + +**Estimated Time:** 2-3 hours + TradingView Pine Script knowledge + +### Risks & Considerations +- Indicator must stay updated (TradingView updates can break) +- Volume profile changes dynamically (recalculates with new data) +- May over-filter in ranging markets (miss valid mean-reversion trades) +- Complexity increases debugging difficulty + +### Success Metrics +- Elimination of entries in obvious consolidation zones +- Higher win rate specifically in ranging markets +- Reduction in whipsaw losses (target: 30-50% fewer) +- Improved P&L per trade (better entries near node edges) + +### Alternatives to Consider +- Use simpler "volume concentration" metric (easier to calculate) +- Implement fixed support/resistance zones instead of dynamic profile +- Combine with Phase 6 range compression (may be sufficient) + +**Recommendation:** Only implement if Phase 1 + Phase 6 don't adequately solve flip-flop problem. Volume profile is most powerful but also most fragile. + +--- + +## Progress Tracking --- @@ -303,10 +495,14 @@ This is a future consideration only. Current data-driven approach is sufficient. ## Progress Tracking ### Milestones -- [x] Nov 11, 2025: Phase 1 infrastructure complete -- [ ] Target: ~Nov 20-25, 2025: Phase 1 complete (10-20 blocked signals) -- [ ] Target: ~Nov 25-30, 2025: Phase 2 analysis complete -- [ ] TBD: Phase 3 implementation (conditional) +- [x] Nov 11, 2025: Phase 1 infrastructure complete (blocked signals tracking) +- [x] Nov 14, 2025: Phase 1.5 complete (signal frequency penalties deployed) +- [ ] Target: ~Nov 20-25, 2025: Phase 2 analysis complete (10-20 blocked signals) +- [ ] Target: ~Nov 25-30, 2025: Phase 3 implementation (threshold adjustment) +- [ ] Target: ~Dec 1-7, 2025: Phase 6 implementation (TradingView range metrics) +- [ ] Target: ~Dec 15-31, 2025: Phase 7 evaluation (Volume Profile integration) +- [ ] TBD: Phase 4 automation (blocked signal price tracking) +- [ ] TBD: Phase 5 ML-based scoring (Q2 2026 or later) ### Metrics to Watch - **Blocked signals collected:** 0/10 minimum