Onats ADR
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © onatski

//@version=4
study("Onats ADR",precision=2)
len =  input(title="Daily Length", type=input.integer, defval = 7)
mult =  input(title="Multiplier", defval = 1.0)
sum = 0.0

//calculate average daily range
for i = 0 to len-1
    sum := sum + high[i] - low[i]

truncate(number, decimals) =>
    factor = pow(10, decimals)
    int(number * factor) / factor
    
adr = truncate((sum/len) * mult,2)

plot(adr)