I`m getting the following error :Compilation error. Line 27: Syntax error at input 'end of line without line continuation' .Any idea what is wrong here ?
//@version=5
strategy("Consecutive", overlay=true)
// Define variables for the MACD and signal line
macd = macd(close, 12, 26)
signal = sma(macd, 9)
// Define a variable to keep track of the number of consecutive green candles
greenCandleCount = 0
// Loop through each bar in the chart
for i = 1 to bar_count - 1
// If the current bar is green, increment the green candle count
if close[i] > open[i]
greenCandleCount := greenCandleCount + 1
else
greenCandleCount := 0
plot(na)
end
// If we have 3 consecutive green candles and the MACD crosses down, plot the "LONG" message
if greenCandleCount == 3 and macd[i] < signal[i] and macd[i+1] > signal[i+1]
plot(high, "LONG", color=green, linewidth=2)
else
plot(na)
end
end
To plot the indicator on the chart, it does not compile .