fix: Skip frequency checks for data collection signals
PROBLEM: - 1-minute data collection signals were getting blocked - Overtrading penalty: '30 signals in 30min (-20 pts)' - Flip-flop penalty: 'opposite direction 1min ago (-25 pts)' - These penalties don't make sense for data collection ROOT CAUSE: - Quality scoring runs for ALL timeframes (needed for analysis) - But frequency checks (overtrading/flip-flop) only apply to production (5min) - Data collection signals (1min, 15min, 1H, etc.) shouldn't be penalized SOLUTION: - Added skipFrequencyCheck parameter to scoreSignalQuality() - Set to true for all non-5min timeframes: skipFrequencyCheck: timeframe !== '5' - Moved timeframe variable declaration earlier for reuse - 1-minute signals now score purely on technical merit (ADX/ATR/RSI/etc.) IMPACT: - 1-minute data collection works correctly - No false 'overtrading' blocks every minute - Quality scores still calculated for cross-timeframe analysis - Production 5min signals still have full frequency validation FILES CHANGED: - app/api/trading/execute/route.ts (quality scoring call) DEPLOYED: Nov 27, 2025 (71.8s build time)
This commit is contained in:
@@ -113,6 +113,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
|||||||
// 📊 CALCULATE QUALITY SCORE BEFORE TIMEFRAME CHECK (Nov 26, 2025)
|
// 📊 CALCULATE QUALITY SCORE BEFORE TIMEFRAME CHECK (Nov 26, 2025)
|
||||||
// CRITICAL: Score ALL signals (5min + data collection) for proper multi-timeframe analysis
|
// CRITICAL: Score ALL signals (5min + data collection) for proper multi-timeframe analysis
|
||||||
// This enables quality-filtered win rate comparison across timeframes
|
// This enables quality-filtered win rate comparison across timeframes
|
||||||
|
const timeframe = body.timeframe || '5'
|
||||||
const qualityResult = await scoreSignalQuality({
|
const qualityResult = await scoreSignalQuality({
|
||||||
atr: body.atr || 0,
|
atr: body.atr || 0,
|
||||||
adx: body.adx || 0,
|
adx: body.adx || 0,
|
||||||
@@ -120,10 +121,11 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
|||||||
volumeRatio: body.volumeRatio || 0,
|
volumeRatio: body.volumeRatio || 0,
|
||||||
pricePosition: body.pricePosition || 0,
|
pricePosition: body.pricePosition || 0,
|
||||||
maGap: body.maGap, // V9: MA gap convergence scoring
|
maGap: body.maGap, // V9: MA gap convergence scoring
|
||||||
timeframe: body.timeframe || '5',
|
timeframe: timeframe,
|
||||||
direction: body.direction,
|
direction: body.direction,
|
||||||
symbol: driftSymbol,
|
symbol: driftSymbol,
|
||||||
currentPrice: body.signalPrice || 0,
|
currentPrice: body.signalPrice || 0,
|
||||||
|
skipFrequencyCheck: timeframe !== '5', // Skip overtrading/flip-flop for data collection
|
||||||
})
|
})
|
||||||
console.log(`📊 Signal quality: ${qualityResult.score} (${qualityResult.score >= 90 ? 'PASS' : 'BLOCKED'})`)
|
console.log(`📊 Signal quality: ${qualityResult.score} (${qualityResult.score >= 90 ? 'PASS' : 'BLOCKED'})`)
|
||||||
if (qualityResult.reasons?.length > 0) {
|
if (qualityResult.reasons?.length > 0) {
|
||||||
@@ -136,8 +138,7 @@ export async function POST(request: NextRequest): Promise<NextResponse<ExecuteTr
|
|||||||
|
|
||||||
// 🔬 MULTI-TIMEFRAME DATA COLLECTION
|
// 🔬 MULTI-TIMEFRAME DATA COLLECTION
|
||||||
// Only execute trades from 5min timeframe OR manual Telegram trades
|
// Only execute trades from 5min timeframe OR manual Telegram trades
|
||||||
// Save other timeframes (15min, 1H, 4H, Daily) for analysis
|
// Save other timeframes (1min, 15min, 1H, 4H, Daily) for analysis
|
||||||
const timeframe = body.timeframe || '5'
|
|
||||||
if (timeframe !== '5' && timeframe !== 'manual') {
|
if (timeframe !== '5' && timeframe !== 'manual') {
|
||||||
console.log(`📊 DATA COLLECTION: ${timeframe}min signal from ${driftSymbol}, saving for analysis (not executing)`)
|
console.log(`📊 DATA COLLECTION: ${timeframe}min signal from ${driftSymbol}, saving for analysis (not executing)`)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user