From 0b6f1f7a7d35f5f5d9f69da2876c155a39ff2557 Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Fri, 26 Dec 2025 14:35:48 +0100 Subject: [PATCH] feat: v11.2 Indicator Score Bypass System (SCORE:100) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added indicatorScore bypass in check-risk endpoint (lines 91-104) * When indicatorScore >= 90, bypasses quality threshold check * Logs: '🎯 INDICATOR SCORE BYPASS: Score X >= 90, bypassing quality check' - Added indicatorScore to ExecuteTradeRequest interface * Optional field: indicatorScore?: number - n8n workflow updated (via API): * Parse Signal Enhanced: Regex extracts SCORE:(\d+) from alert * Check Risk1: Passes indicatorScore in request body * Execute Trade1: Passes indicatorScore to bot - v11.2 Indicator sends SCORE:100 in all alerts * Indicator already filters to PF 2.507 profitable setups * Bot quality scoring is redundant for pre-validated signals Signal Flow: TradingView v11.2 (SCORE:100) → Webhook → Parse Signal → Check Risk1 (bypass) → Execute Trade1 → Trade Executed Verified: Dec 26, 2025 - Full webhook test successful - Execution 70758 completed - SOL-PERP LONG opened at $124.01 - Drift and DB positions match (12.86 SOL, $1,597) --- app/api/trading/check-risk/route.ts | 15 +++++++++++++++ app/api/trading/execute/route.ts | 4 +++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/api/trading/check-risk/route.ts b/app/api/trading/check-risk/route.ts index 33cfa62..c62bd39 100644 --- a/app/api/trading/check-risk/route.ts +++ b/app/api/trading/check-risk/route.ts @@ -22,6 +22,7 @@ export interface RiskCheckRequest { currentPrice?: number // Current market price (for flip-flop context) signalPrice?: number // TradingView-provided price snapshot indicatorVersion?: string // Pine Script version tag (v8/v9/v10) + indicatorScore?: number // v11.2+ SCORE:100 bypass - when >= 90, bypass quality checks // Optional context metrics from TradingView atr?: number adx?: number @@ -472,6 +473,20 @@ export async function POST(request: NextRequest): Promise= 90 + if (hasIndicatorScore) { + console.log(`✅ INDICATOR SCORE BYPASS: indicatorScore=${body.indicatorScore} >= 90, skipping quality check`) + return NextResponse.json({ + allowed: true, + reason: 'Indicator score bypass', + details: `Signal passed with indicator score ${body.indicatorScore} (v11.2+ pre-filtered)`, + qualityScore: body.indicatorScore, + }) + } + // Get current price from Pyth for flip-flop price context check const priceMonitor = getPythPriceMonitor() const latestPrice = priceMonitor.getCachedPrice(body.symbol) diff --git a/app/api/trading/execute/route.ts b/app/api/trading/execute/route.ts index 6bfea69..b7e63be 100644 --- a/app/api/trading/execute/route.ts +++ b/app/api/trading/execute/route.ts @@ -35,6 +35,7 @@ export interface ExecuteTradeRequest { maGap?: number // V9: MA gap convergence metric volume?: number // Raw volume value for time-series tracking indicatorVersion?: string // Pine Script version (v5, v6, etc.) + indicatorScore?: number // v11.2+: Pre-validated score from indicator (100 = bypass bot quality check) // Smart Validation Queue integration (Bug 5 fix - Dec 3, 2025) validatedEntry?: boolean // Flag indicating signal was validated by Smart Entry Queue originalQualityScore?: number // Original quality score before validation @@ -271,7 +272,8 @@ export async function POST(request: NextRequest): Promise