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:
@@ -22,6 +22,7 @@ export interface RiskCheckRequest {
|
|||||||
currentPrice?: number // Current market price (for flip-flop context)
|
currentPrice?: number // Current market price (for flip-flop context)
|
||||||
signalPrice?: number // TradingView-provided price snapshot
|
signalPrice?: number // TradingView-provided price snapshot
|
||||||
indicatorVersion?: string // Pine Script version tag (v8/v9/v10)
|
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
|
// Optional context metrics from TradingView
|
||||||
atr?: number
|
atr?: number
|
||||||
adx?: number
|
adx?: number
|
||||||
@@ -472,6 +473,20 @@ export async function POST(request: NextRequest): Promise<NextResponse<RiskCheck
|
|||||||
|
|
||||||
// 5. Check signal quality (if context metrics provided)
|
// 5. Check signal quality (if context metrics provided)
|
||||||
if (hasContextMetrics) {
|
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
|
// Get current price from Pyth for flip-flop price context check
|
||||||
const priceMonitor = getPythPriceMonitor()
|
const priceMonitor = getPythPriceMonitor()
|
||||||
const latestPrice = priceMonitor.getCachedPrice(body.symbol)
|
const latestPrice = priceMonitor.getCachedPrice(body.symbol)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export interface ExecuteTradeRequest {
|
|||||||
maGap?: number // V9: MA gap convergence metric
|
maGap?: number // V9: MA gap convergence metric
|
||||||
volume?: number // Raw volume value for time-series tracking
|
volume?: number // Raw volume value for time-series tracking
|
||||||
indicatorVersion?: string // Pine Script version (v5, v6, etc.)
|
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)
|
// Smart Validation Queue integration (Bug 5 fix - Dec 3, 2025)
|
||||||
validatedEntry?: boolean // Flag indicating signal was validated by Smart Entry Queue
|
validatedEntry?: boolean // Flag indicating signal was validated by Smart Entry Queue
|
||||||
originalQualityScore?: number // Original quality score before validation
|
originalQualityScore?: number // Original quality score before validation
|
||||||
@@ -271,7 +272,8 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
|||||||
if (hasIndicatorScore) {
|
if (hasIndicatorScore) {
|
||||||
console.log(`✅ INDICATOR SCORE BYPASS: Using indicator score ${body.indicatorScore} (indicator pre-filtered to profitable)`)
|
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
|
// 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
|
// CRITICAL FIX (Nov 27, 2025): Verify quality score meets minimum threshold
|
||||||
|
|||||||
Reference in New Issue
Block a user