Add timeframe-aware signal quality scoring for 5min charts
- Lower ADX/ATR thresholds for 5min timeframe (ADX 12-22, ATR 0.2-0.7%) - Add anti-chop filter: -20 points for extreme sideways (ADX<10, ATR<0.25, Vol<0.9) - Pass timeframe parameter through check-risk and execute endpoints - Fixes flip-flop losses from overly strict 5min filters - Higher timeframes unchanged (still use ADX 18+, ATR 0.4+) 5min scoring now: - ADX 12-15: moderate trend (+5) - ADX 22+: strong trend (+15) - ATR 0.2-0.35: acceptable (+5) - ATR 0.35+: healthy (+10) - Extreme chop penalty prevents whipsaw trades
This commit is contained in:
@@ -15,6 +15,7 @@ import { scoreSignalQuality, SignalQualityResult } from '@/lib/trading/signal-qu
|
||||
export interface RiskCheckRequest {
|
||||
symbol: string
|
||||
direction: 'long' | 'short'
|
||||
timeframe?: string // e.g., '5', '15', '60', '1D'
|
||||
// Optional context metrics from TradingView
|
||||
atr?: number
|
||||
adx?: number
|
||||
@@ -57,6 +58,7 @@ function shouldAllowScaling(
|
||||
pricePosition: newSignal.pricePosition,
|
||||
direction: newSignal.direction,
|
||||
minScore: config.minScaleQualityScore,
|
||||
timeframe: newSignal.timeframe,
|
||||
})
|
||||
|
||||
// 2. Check quality score (higher bar than initial entry)
|
||||
@@ -271,7 +273,8 @@ export async function POST(request: NextRequest): Promise<NextResponse<RiskCheck
|
||||
volumeRatio: body.volumeRatio || 0,
|
||||
pricePosition: body.pricePosition || 0,
|
||||
direction: body.direction,
|
||||
minScore: 60 // Hardcoded threshold
|
||||
minScore: 60, // Hardcoded threshold
|
||||
timeframe: body.timeframe,
|
||||
})
|
||||
|
||||
if (!qualityScore.passed) {
|
||||
|
||||
Reference in New Issue
Block a user