Resources are still Pine Script 3 heavy, so I think I'm mixing something up:
I tried to create an Average Daily Range indicator, which is basically the ATR that takes a "D" input no matter what the time frame of the current chart is. My code works perfectly fine on Pine Script 3, but Pine Script 4 throws out the following errors:
line 4: Undeclared identifier `resolution`;
line 6: Undeclared identifier `tickerid`;
line 6: Undeclared identifier `dRange`;
line 8: Undeclared identifier `adRange`
The docs indicate resolution
is still an input()
argument, and I'm not sure why anything else is called "undeclared".
My full code is:
//@version=4
study(title="Average Daily Range", shorttitle="ADR", overlay=false)
dRange = input(defval="D", title="Daily Range", type=resolution)
adRange = security(tickerid, dRange, rma(tr, 5))
plot(adRange, title = "ADR", color=#000000, transp=0)
What are these "Undeclared identifiers"? And what must I do differently in Pine Script 4 so that I'm getting the same result?
Thank you.