-3

I am new to TradingView Pine scripting. I am seeking for help with a pine script which is on version 2 right now but I am trying convert it into Version 5 and is having so many compilation errors. I would really appreciate any help. Thank you all in advance.

//@version=2
study(title="test", shorttitle="Positive")
EMA_Len = input(255, minval=1)
xROC = roc(close, 1)
nRes = iff(volume > volume[1], nz(nRes[1], 0) + xROC, nz(nRes[1], 0))
nResEMA = ema(nRes, EMA_Len)
plot(nRes, color=red, title="PVI")
plot(nResEMA, color=blue, title="EMA")

1 Answers1

0
indicator(title='test', shorttitle='Positive')
EMA_Len = input.int(255, minval=1)
xROC = ta.roc(close, 1)
nRes = 0.0
nRes := volume > volume[1] ? nz(nRes[1], 0) + xROC : nz(nRes[1], 0)
nResEMA = ta.ema(nRes, EMA_Len)
plot(nRes, color=color.new(color.red, 0), title='PVI')
plot(nResEMA, color=color.new(color.blue, 0), title='EMA')