After looking through the Pine-Script documentation I could not figure out there "Switch" style conditional statement.
I'm trying to subtract the opening and the closing from only the green candles.
This is my current code:
//@version=3 study(title="High Minus Low", shorttitle="HM0", overlay=true)
openall = high[0]+high[1]+high[2]
closeall = open[0]+open[1]+open[2] total = openall + closeall
plot(total)
I only want to grab the latest 3 green candle bars using a conditional statement.
Is this possible?