optimize: Reduce 1-min webhook payload from 8 metrics to 2 (price + ADX only)

- Removed 6 unused metrics: ATR, RSI, volumeRatio, pricePosition, maGap, volume
- Systems only use: currentPrice (Smart Validation Queue) + ADX (adaptive trailing + revenge)
- Result: 75% smaller webhook payload (may fix 5-min signal skipping issue)
- Backward compatible: n8n parser handles missing fields gracefully
- Testing: Upload to TradingView and monitor if 5-min signals process normally
This commit is contained in:
mindesbunister
2025-12-04 19:53:12 +01:00
parent 31ef8b01f2
commit 5feb6ba61b

View File

@@ -1,36 +1,35 @@
//@version=6 //@version=6
indicator("Money Line - 1min Data Feed", overlay=false) indicator("Money Line - 1min Data Feed (OPTIMIZED)", overlay=false)
// ========================================== // ==========================================
// PURPOSE: Send market data every 1 minute for cache updates // PURPOSE: Send ONLY essential market data every 1 minute (price + ADX)
// OPTIMIZED (Dec 4, 2025): Reduced from 8 metrics to 2 metrics (75% smaller payload)
//
// WHY: Systems only use currentPrice and ADX from 1-minute data:
// - Price: Smart Validation Queue price confirmation
// - ADX: Adaptive trailing stop (Phase 7.3) + Revenge system validation
// - Removed: ATR, RSI, volumeRatio, pricePosition, maGap, volume (NOT used)
//
// USAGE: Create alert on indicator with "alert() function calls" // USAGE: Create alert on indicator with "alert() function calls"
// WEBHOOK: https://flow.egonetix.de/webhook/tradingview-bot-v4 (SAME as trading signals) // WEBHOOK: https://flow.egonetix.de/webhook/tradingview-bot-v4 (SAME as trading signals)
// FORMAT: Uses trading signal format with timeframe="1" (gets filtered like 15min/1H/Daily) // FORMAT: Uses trading signal format with timeframe="1" (gets filtered like 15min/1H/Daily)
// ========================================== // ==========================================
// Calculate indicators (same as v9 for consistency) // Calculate ONLY what we actually use
atr = ta.atr(14) [diPlus, diMinus, adx] = ta.dmi(14, 14) // ADX for adaptive trailing + revenge validation
[diPlus, diMinus, adx] = ta.dmi(14, 14) // ADX returns tuple in Pine v5+
rsi = ta.rsi(close, 14)
volumeRatio = volume / ta.sma(volume, 20)
pricePosition = (close - ta.lowest(low, 100)) / (ta.highest(high, 100) - ta.lowest(low, 100)) * 100
// Moving averages for MA gap analysis // Display ADX (visual confirmation)
ma50 = ta.sma(close, 50)
ma200 = ta.sma(close, 200)
maGap = math.abs((ma50 - ma200) / ma200 * 100)
// Display values (optional - for visual confirmation)
plot(adx, "ADX", color=color.blue, linewidth=2) plot(adx, "ADX", color=color.blue, linewidth=2)
plot(close, "Price", color=color.white, linewidth=1)
hline(20, "ADX 20", color=color.gray, linestyle=hline.style_dashed) hline(20, "ADX 20", color=color.gray, linestyle=hline.style_dashed)
hline(25, "ADX 25", color=color.orange, linestyle=hline.style_dashed) hline(25, "ADX 25", color=color.orange, linestyle=hline.style_dashed)
// Build JSON message using TRADING SIGNAL format (gets filtered by timeframe="1") // Build OPTIMIZED message - ONLY price + ADX (75% smaller than old format)
// Direction doesn't matter - bot filters by timeframe before executing // Direction doesn't matter - bot filters by timeframe before executing
// This follows same pattern as 15min/1H/Daily data collection // This follows same pattern as 15min/1H/Daily data collection
// CRITICAL: Include close price so bot logs correct price (not RSI/ATR value) // CRITICAL: Include @ price format so n8n parser extracts signalPrice correctly
jsonMessage = 'SOLUSDT buy 1 @ ' + str.tostring(close) + ' | ATR:' + str.tostring(atr) + ' | ADX:' + str.tostring(adx) + ' | RSI:' + str.tostring(rsi) + ' | VOL:' + str.tostring(volumeRatio) + ' | POS:' + str.tostring(pricePosition) + ' | IND:v9' jsonMessage = 'SOLUSDT buy 1 @ ' + str.tostring(close) + ' | ADX:' + str.tostring(adx) + ' | IND:v9'
// Send alert every bar close // Send alert every bar close (every 1 minute on 1min chart)
if barstate.isconfirmed if barstate.isconfirmed
alert(jsonMessage, alert.freq_once_per_bar) alert(jsonMessage, alert.freq_once_per_bar)