[RS]ADR channel V0

EXPERIMENTAL: needs validation if calculation is correct for the ADR. granted it has more use with optional timeframe.
Remove from Favorite Scripts Add to favorite indicators
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)


Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out