ADR: Average Daily Range
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © cattledoger

//@version=4
study("ADR-Average Daily Range", precision=1)
len = input(26, minval=1, maxval=200, title="EMA Length")
MA = sma(close,len)
avg_dailytop = highest(high, 8)
avg_dailylow = lowest(low, 8)
dailytop = (avg_dailytop+MA)/2
dailylow = (avg_dailylow+MA)/2
super_avg = (dailytop+dailylow)/2
plot(int(super_avg), 'Midline', color=color.blue)
plot(int(MA), 'SMA', color=color.aqua)
plot(int(dailytop), 'Average Top', color=color.orange)
plot(int(dailylow), 'Average Low', color=color.orange)