I have a drop-down choice that works ok, and can't figure out how to get If else statement to work. Did try If, then if else and nothing is working. else if (typ4 == rma) << is not working or just else alone
Pine gives the following error, any help be really appreaciated Mismatched input 'wma' expecting 'end of line without line continuation'.
//@version=4
strategy("Testing", overlay=true)
showSMA2 = input(title="Toggle WMA/RMA/VWMA/VWAP/HullMA", type=input.bool, defval=true)
typ4 = input(title="Choice", defval="WMA", options=["WMA", "RMA", "VWMA", "VWAP", "HullMA"])
len4 = input(9, minval=1, maxval=8, title="Length")
src4 = input(title="Source OHLC", type=input.source, defval=close)
out = if (typ4 == wma)
wma(src4, len4)
if (typ4 == rma)
rma(src4, len4)
if (typ4 == vwma)
vwma(src4, len4)
if (typ4 == vwap)
vwap(src4, len4)
if (typ4 == hullma)
hullma(src4, len4)
plot(out, title="Custom", color=iff(showSMA2, color.green, na))
Aucun commentaire:
Enregistrer un commentaire