diff --git a/workflows/trading/moneyline_1min_data_feed.pinescript b/workflows/trading/moneyline_1min_data_feed.pinescript index f544c40..ab338df 100644 --- a/workflows/trading/moneyline_1min_data_feed.pinescript +++ b/workflows/trading/moneyline_1min_data_feed.pinescript @@ -3,7 +3,7 @@ indicator("Money Line - 1min Data Feed", overlay=false) // ========================================== // PURPOSE: Send market data every 1 minute -// USAGE: Create alert with "Once Per Bar Close" +// USAGE: Create alert on indicator with "alert() function calls" // WEBHOOK: https://flow.egonetix.de/webhook/tradingview-bot-v4 // ========================================== @@ -24,6 +24,22 @@ plot(adx, "ADX", color=color.blue, linewidth=2) hline(20, "ADX 20", color=color.gray, linestyle=hline.style_dashed) hline(25, "ADX 25", color=color.orange, linestyle=hline.style_dashed) -// Alert condition: Every bar close (fires every 1 minute on 1-min chart) -// Message must be const string - build JSON directly in alertcondition -alertcondition(true, title="1min Data Feed", message='{"action":"market_data_1min","symbol":"{{ticker}}","timeframe":"1","atr":{{plot_0}},"adx":{{plot_1}},"rsi":' + str.tostring(rsi) + ',"volumeRatio":' + str.tostring(volumeRatio) + ',"pricePosition":' + str.tostring(pricePosition) + ',"currentPrice":{{close}},"maGap":' + str.tostring(maGap) + ',"indicatorVersion":"v9"}') +// Build JSON message dynamically +// alert() function allows series string (dynamic values) +jsonMessage = '{"action":"market_data_1min"' + + ',"symbol":"' + syminfo.ticker + '"' + + ',"timeframe":"1"' + + ',"atr":' + str.tostring(atr) + + ',"adx":' + str.tostring(adx) + + ',"rsi":' + str.tostring(rsi) + + ',"volumeRatio":' + str.tostring(volumeRatio) + + ',"pricePosition":' + str.tostring(pricePosition) + + ',"currentPrice":' + str.tostring(close) + + ',"maGap":' + str.tostring(maGap) + + ',"timestamp":' + str.tostring(time) + + ',"indicatorVersion":"v9"}' + +// Send alert every bar close +// Use alert() instead of alertcondition() to allow dynamic message +if barstate.isconfirmed + alert(jsonMessage, alert.freq_once_per_bar)