- Create moneyline_1min_price_feed.pinescript (70% smaller payload) - Remove ATR/ADX/RSI/VOL/POS from 1-minute alerts (not used for decisions) - Keep only price + symbol + timeframe for market data cache - Document rationale in docs/1MIN_SIMPLIFIED_FEED.md - Fix: 5-minute trading signals being dropped due to 1-minute flood (60/hour) - Impact: Preserve priority for actual trading signals
6.0 KiB
6.0 KiB
1-Minute Simplified Price Feed (Dec 4, 2025)
Problem Statement
Issue: TradingView alert queue getting overwhelmed by 1-minute signal flood
- Volume: 60 alerts/hour (one per minute) from 1-minute data feed
- Impact: 5-minute trading signals occasionally skipped (happened 2× so far)
- Root cause: 1-minute alerts sending full trading signal format with all indicators
Solution: Lightweight Price-Only Feed
Change: Reduce 1-minute alert payload by ~70%
Before (Full Format)
SOLUSDT buy 1 @ 142.08 | ATR:0.65 | ADX:14.3 | RSI:51.3 | VOL:0.87 | POS:59.3 | IND:v9
Size: ~80 characters Processing: n8n parses 7 fields, bot calculates quality score, saves to BlockedSignal + MarketData
After (Minimal Format)
SOLUSDT buy 1 @ 142.08
Size: ~22 characters (~73% reduction) Processing: n8n parses 3 fields (symbol/timeframe/price), bot routes to BlockedSignal only
Why This Works
What We Actually Need from 1-Minute Data
- ✅ Price updates - For market data cache (5-minute expiry)
- ✅ Symbol identification - Routing to correct market
- ✅ Timeframe marker -
timeframe="1"triggers data collection path - ❌ ATR/ADX/RSI/VOL/POS - NOT used in real-time (recalculated from DB if needed)
- ❌ Direction - Meaningless for data-only signals (see copilot-instructions.md)
What We Already Have
- 5-minute signals include full indicator context for trading decisions
- BlockedSignalTracker recalculates TP1/TP2/SL from database data (not live indicators)
- Market data cache only needs
currentPrice+timestampfor validation (5-minute expiry) - MarketData table can store NULL for indicators (not critical for analysis)
What Gets Removed
// OLD: Execute endpoint saves full metrics to MarketData table
await prisma.marketData.create({
data: {
atr: Number(body.atr) || 0, // ❌ Remove
adx: Number(body.adx) || 0, // ❌ Remove
rsi: Number(body.rsi) || 50, // ❌ Remove
volumeRatio: Number(body.volumeRatio) || 1.0, // ❌ Remove
pricePosition: Number(body.pricePosition) || 50, // ❌ Remove
maGap: Number(body.maGap) || undefined, // ❌ Remove
// Keep essentials
symbol: driftSymbol, // ✅ Keep
timeframe: '1', // ✅ Keep
price: currentPrice, // ✅ Keep
timestamp: new Date() // ✅ Keep (auto-generated)
}
})
Implementation Plan
Phase 1: Update TradingView Alert (IMMEDIATE)
- Replace
moneyline_1min_data_feed.pinescriptwithmoneyline_1min_price_feed.pinescript - Update TradingView alert to use new script
- Test: Verify alerts still route to BlockedSignal correctly
Phase 2: Update Execute Endpoint (OPTIONAL)
Since we're only sending price, make execute endpoint resilient to missing fields:
// Lines 193-207: MarketData.create()
// Change required fields to optional with safe defaults
atr: Number(body.atr) || null, // NULL if missing
adx: Number(body.adx) || null,
rsi: Number(body.rsi) || null,
// ... etc
Phase 3: Monitor Results
- Track 5-minute signal reliability (should go from 98% → 100%)
- Verify 1-minute data still saves to BlockedSignal
- Check TradingView alert queue no longer shows congestion
Expected Impact
Benefits
- 70% reduction in TradingView alert payload size
- Priority preservation - 5-minute trading signals less likely to be dropped
- Faster processing - Less n8n parsing, less bot processing
- Same functionality - No loss of critical features
Tradeoffs
- MarketData table will have NULL indicators (acceptable - not used for decisions)
- Historical 1-minute indicator data less complete (acceptable - we have 5-minute full data)
No Impact On
- ✅ 5-minute trading signals (still full format with all indicators)
- ✅ BlockedSignalTracker (calculates from price movements, not live indicators)
- ✅ Market data cache (only needs price + timestamp)
- ✅ Smart Entry Validation (uses 5-minute cached data, not 1-minute)
Files Changed
TradingView Pine Script
- NEW:
workflows/trading/moneyline_1min_price_feed.pinescript- Simplified version - OLD:
workflows/trading/moneyline_1min_data_feed.pinescript- Full format (archived)
n8n Workflow
- UNCHANGED:
workflows/trading/parse_signal_enhanced.json- Already handles minimal format- Extracts:
symbol,timeframe,signalPrice(from@ pricepattern) - Defaults: ATR/ADX/RSI/etc to 0 if missing
- Extracts:
Bot Code
- UNCHANGED:
app/api/trading/execute/route.ts- Already handles missing fields with fallbacks- Lines 193-207: Uses
Number(body.field) || defaultpattern
- Lines 193-207: Uses
Migration Steps
- ✅ Read this document - Understand rationale
- ⏳ Update TradingView alert - Replace with
moneyline_1min_price_feed.pinescript - ⏳ Test with 1-2 alerts - Verify BlockedSignal still populates
- ⏳ Monitor for 24 hours - Check 5-minute signal reliability
- ⏳ Archive old script - Move
moneyline_1min_data_feed.pinescriptto archive/
Rollback Plan
If issues arise:
- Switch TradingView alert back to
moneyline_1min_data_feed.pinescript - No code changes needed - bot handles both formats
Decision Criteria
Use simplified feed IF:
- 5-minute signal drops are occurring regularly (2+ per week)
- TradingView alert queue shows congestion
- 1-minute indicator data not being used for analysis
Keep full feed IF:
- 5-minute signals are 100% reliable
- Future analysis requires minute-by-minute indicator tracking
- No performance issues observed
Current Status (Dec 4, 2025)
- ✅ Simplified script created
- ⏳ TradingView alert update pending
- ⏳ Monitoring results pending
- User decision: Test simplified feed for 24-48 hours
References
- Copilot Instructions: Section "1-Minute Data Collection System"
- Original Implementation:
docs/1MIN_DATA_COLLECTION_SIMPLE.md - BlockedSignalTracker:
lib/analysis/blocked-signal-tracker.ts