I don’t know this script is Version 2 or Version 3. Please help convert the code to Pine Script Version 4. Thank you for your help!
study(title="Trending")
EMA_Len = input(89, title="Length", minval=1)
Sig_Len = input(14, title="Signal Length", minval=1)
xROC = roc(close, 1)
nRes1 = iff(volume < volume[1], nz(nRes1[1], 0) + xROC, nz(nRes1[1], 0))
nRes2 = iff(volume > volume[1], nz(nRes2[1], 0) + xROC, nz(nRes2[1], 0))
nRes3 = nRes1 + nRes2
nResEMA3 = sma(nRes1, EMA_Len) + sma(nRes2, EMA_Len)
diff = nRes3 - nResEMA3
signal = ema(diff, Sig_Len)
plot(40, color=#c4c4c4, transp = 35)
plot(20, color=#c4c4c4, transp = 35)
plot(0, "Zero Line", color = red, transp = 75)
plot(-20, color=#c4c4c4, transp = 35)
plot(-40, color=#c4c4c4, transp = 35)
plot(diff, color = #009cff, transp = 0)
plot(signal, title="Signal", linewidth = 1, color= #ff6a00, transp=0)
I looked for Version 4 of the code but didn’t find.
New contributor
sheerguide is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1