feat: v11.2 Indicator Score Bypass System (SCORE:100)

- 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)
This commit is contained in:
mindesbunister
2025-12-26 14:35:48 +01:00
parent a8dcee612a
commit 0b6f1f7a7d
2 changed files with 18 additions and 1 deletions

View File

@@ -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<NextResponse<RiskCheck
// 5. Check signal quality (if context metrics provided)
if (hasContextMetrics) {
// v11.2+ INDICATOR SCORE BYPASS (Dec 26, 2025)
// If indicator sends SCORE:100, it already filtered to 2.507 PF profitable setups
// Bypass bot's quality recalculation to avoid redundant two-layer filtering
const hasIndicatorScore = typeof body.indicatorScore === 'number' && body.indicatorScore >= 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)

View File

@@ -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<NextResponse<ExecuteTr
if (hasIndicatorScore) {
console.log(`✅ INDICATOR SCORE BYPASS: Using indicator score ${body.indicatorScore} (indicator pre-filtered to profitable)`)
// Override bot's quality score with indicator's score for adaptive leverage
qualityResult.score = body.indicatorScore
// Note: hasIndicatorScore already verified typeof body.indicatorScore === 'number'
qualityResult.score = body.indicatorScore as number
}
// CRITICAL FIX (Nov 27, 2025): Verify quality score meets minimum threshold