RicardoSantos

[RS]ADR channel V0

2680 views
204
EXPERIMENTAL: needs validation if calculation is correct for the ADR. granted it has more use with optional timeframe.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
study("[RS]ADR channel V0", overlay=true)
tf = input(title='Timeframe:', type=string, defval='D')
window = input(title='Time Window:', type=integer, defval=30)
USE_AVGCENTER = input(title='Use Average Center or Open:', type=bool, defval=false)

adr = security(tickerid, tf, sma(tr, window))

middle = security(tickerid, tf, USE_AVGCENTER ? avg(high, low) : open)
upper = middle + adr
lower = middle - adr

plot(middle, title='middle line', color=change(middle)!=0?na:black, linewidth=1)
plot(upper, title='upper line', color=change(upper)!=0?na:black, linewidth=1)
plot(lower, title='lower line', color=change(lower)!=0?na:black, linewidth=1)

Comments