# 1-Minute Market Data Collection - Simple Setup **Date:** November 27, 2025 **Status:** CORRECTED - Uses same webhook as trading signals --- ## Summary 1-minute data collection **uses the same workflow** as 15min/1H/Daily data collection: - Same webhook URL as trading signals (`tradingview-bot-v4`) - Same n8n workflow (Money Machine) - Bot filters by `timeframe="1"` and saves to BlockedSignal (no trades executed) **No separate webhook needed!** 🎉 --- ## Pine Script Indicator **File:** `/home/icke/traderv4/workflows/trading/moneyline_1min_data_feed.pinescript` **Alert message format:** ``` SOLUSDT buy 1 | ATR:0.43 | ADX:25.8 | RSI:58.2 | VOL:1.15 | POS:62.4 | IND:v9 ``` **Key:** `timeframe="1"` tells bot this is data collection only --- ## TradingView Alert Setup ### 1. Add Indicator to Chart - Chart: SOL-PERP, ETH-PERP, or BTC-PERP - Timeframe: **1 minute** - Add indicator: "Money Line - 1min Data Feed" ### 2. Create Alert **Settings Tab:** - Condition: "Money Line - 1min Data Feed" > "Any alert() function call" - Interval: **1m** - Expiration: Open-ended **Message Tab:** - Alert name: `SOL-PERP 1min Data Feed` - Message: Leave blank - Webhook URL: `https://flow.egonetix.de/webhook/tradingview-bot-v4` ✅ - ✅ Check "Webhook URL" ### 3. Repeat for All Symbols - SOL-PERP 1min Data Feed (SOLUSDT.P chart) - ETH-PERP 1min Data Feed (ETHUSDT chart) - BTC-PERP 1min Data Feed (BTCUSDT chart) --- ## How It Works ``` TradingView Alert (1min candle close) ↓ "SOLUSDT buy 1 | ATR:0.43 | ADX:25.8..." ↓ Webhook: tradingview-bot-v4 (SAME as trading signals) ↓ n8n: Parse Signal Enhanced ↓ Extracts: timeframe="1", symbol="SOL-PERP", metrics... ↓ n8n: Check Risk → Execute Trade ↓ Bot: /api/trading/execute ↓ if (timeframe !== '5') { // DATA COLLECTION PATH (same as 15min/1H/Daily) await createBlockedSignal({ blockReason: 'DATA_COLLECTION_ONLY', timeframe: '1', atr, adx, rsi, volumeRatio, pricePosition }) return { success: true, dataCollection: true } } ↓ n8n: Receives success=true (no trade notification) ↓ Bot: BlockedSignal table updated ``` **Result:** Market data cached, no trade executed ✅ --- ## Verification ### 1. Check BlockedSignal Table ```bash docker exec trading-bot-postgres psql -U postgres -d trading_bot_v4 -c " SELECT symbol, direction, timeframe, TO_CHAR(\"createdAt\", 'MM-DD HH24:MI:SS') as time, \"signalQualityScore\" as score, blockReason FROM \"BlockedSignal\" WHERE timeframe = '1' ORDER BY \"createdAt\" DESC LIMIT 10; " ``` **Expected:** Entries with `timeframe='1'`, `blockReason='DATA_COLLECTION_ONLY'` ### 2. Check Bot Logs ```bash docker logs trading-bot-v4 -f | grep "DATA COLLECTION" # Expected: "📊 DATA COLLECTION: 1min signal from SOL-PERP, saving for analysis" ``` ### 3. Verify Cache Updates ```bash docker logs trading-bot-v4 -f | grep "Market data auto-cached" # Expected: "📊 Market data auto-cached for SOL-PERP from trade signal" ``` ### 4. Confirm No Trades Executed ```bash docker logs trading-bot-v4 -f | grep "POSITION OPENED" # Should NOT see entries from 1-minute alerts # Only 5-minute trading signals should open positions ``` --- ## Expected Behavior ### Data Frequency - **Per Symbol:** 60 signals/hour = 1,440/day - **Total (3 symbols):** 180 signals/hour = 4,320/day - **Storage:** ~10-15 KB/signal in BlockedSignal table ### No Separate Webhook Needed - 15min signals: `buy 15` → timeframe="15" → Data collection ✅ - 1H signals: `buy 60` → timeframe="60" → Data collection ✅ - 1min signals: `buy 1` → timeframe="1" → Data collection ✅ - 5min signals: `buy 5` → timeframe="5" → **Execute trade** ✅ All use the **same webhook**! Bot routes by timeframe. --- ## Comparison: Old vs New Approach ### ❌ Old (Overcomplicated) - Separate `market_data_handler.json` workflow - Different webhook URL: `webhook/UNIQUE_ID` - JSON format: `{"action":"market_data_1min",...}` - Requires n8n workflow import/configuration ### ✅ New (Simple) - Uses existing Money Machine workflow - Same webhook: `webhook/tradingview-bot-v4` - Text format: `SOLUSDT buy 1 | ATR:0.43...` - Already configured - just create alerts! --- ## Benefits 1. **No n8n changes needed** - Uses existing workflow 2. **No separate webhook** - Same as trading signals 3. **Consistent pattern** - Same as 15min/1H/Daily 4. **Simpler setup** - Just create TradingView alerts 5. **Same monitoring** - BlockedSignal table + bot logs --- ## Next Steps 1. ✅ Update Pine Script indicator (DONE - commit cb02976) 2. Copy/paste new indicator code to TradingView 3. Create 3 alerts (SOL/ETH/BTC) with webhook `tradingview-bot-v4` 4. Monitor logs for 10 minutes (verify data collection, no trades) 5. Check BlockedSignal table for `timeframe='1'` entries --- ## Files Changed - `/home/icke/traderv4/workflows/trading/moneyline_1min_data_feed.pinescript` - Changed to trading signal format - Git commit: cb02976 "fix: Change 1-min indicator to use trading signal format" --- ## Key Takeaway **You were right!** 1-minute data collection is **NOT different** from 15min/1H/Daily. The bot already handles this pattern perfectly - we just needed to use the same format. No separate infrastructure needed! 🎉