fix: Pine Script syntax errors - v6, ADX tuple destructuring, var declaration

- Upgraded to @version=6 (v5 outdated)
- Fixed ADX: ta.dmi() returns tuple [diPlus, diMinus, adx] - must destructure
- Fixed alertMessage: Added 'var string' declaration for proper scoping
- Now compiles without errors

Errors fixed:
- Line 1: Version 5 outdated → v6
- Line 6: ADX tuple assignment → [diPlus, diMinus, adx] = ta.dmi(14, 14)
- Line 12: plot() argument type → adx now properly extracted from tuple
- Line 16: String concatenation → var string declaration added
This commit is contained in:
mindesbunister
2025-11-27 08:57:04 +01:00
parent 4458cd1dae
commit 6834a1cf4c

View File

@@ -1,4 +1,4 @@
//@version=5
//@version=6
indicator("Money Line - 1min Data Feed", overlay=false)
// ==========================================
@@ -9,7 +9,7 @@ indicator("Money Line - 1min Data Feed", overlay=false)
// Calculate indicators (same as v9 for consistency)
atr = ta.atr(14)
adx = ta.dmi(14, 14)
[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
@@ -26,7 +26,7 @@ hline(25, "ADX 25", color=color.orange, linestyle=hline.style_dashed)
// Alert message - JSON format
// Note: Use action "market_data_1min" to distinguish from trend-change alerts
alertMessage = '{"action":"market_data_1min","symbol":"' + syminfo.ticker +
var string alertMessage = '{"action":"market_data_1min","symbol":"' + syminfo.ticker +
'","timeframe":"1","atr":' + str.tostring(atr) +
',"adx":' + str.tostring(adx) +
',"rsi":' + str.tostring(rsi) +