fix: Single line string concatenation for Pine Script v6
Pine Script v6 does not support multi-line string concatenation Put entire JSON message on single line
This commit is contained in:
@@ -24,22 +24,9 @@ plot(adx, "ADX", color=color.blue, linewidth=2)
|
|||||||
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 dynamically
|
// Build JSON message dynamically (single line - Pine v6 doesn't support multi-line concatenation)
|
||||||
// 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"}'
|
||||||
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
|
// Send alert every bar close
|
||||||
// Use alert() instead of alertcondition() to allow dynamic message
|
|
||||||
if barstate.isconfirmed
|
if barstate.isconfirmed
|
||||||
alert(jsonMessage, alert.freq_once_per_bar)
|
alert(jsonMessage, alert.freq_once_per_bar)
|
||||||
|
|||||||
Reference in New Issue
Block a user