#ADR, Murat Ilgar
#Hint: Average Daily Range, Quallmaggie TC2000
def len = 1;
def dayHigh = DailyHighLow(AggregationPeriod.DAY, len, 0, no).DailyHigh;
def dayLow = DailyHighLow(AggregationPeriod.DAY, len, 0, no).DailyLow;
def ADR_highlow = (
dayHigh/dayLow + dayHigh[1]/dayLow[1] +
dayHigh[2]/dayLow[2] +
dayHigh[3]/dayLow[3] +
dayHigh[4]/dayLow[4] +
dayHigh[5]/dayLow[5] +
dayHigh[6]/dayLow[6] +
dayHigh[7]/dayLow[7] +
dayHigh[8]/dayLow[8] +
dayHigh[9]/dayLow[9] +
dayHigh[10]/dayLow[10] +
dayHigh[11]/dayLow[11] +
dayHigh[12]/dayLow[12] +
dayHigh[13]/dayLow[13] +
dayHigh[14]/dayLow[14] +
dayHigh[15]/dayLow[15] +
dayHigh[16]/dayLow[16] +
dayHigh[17]/dayLow[17] +
dayHigh[18]/dayLow[18] +
dayHigh[19]/dayLow[19]) / 20;
plot ADR_perc = 100*(ADR_highlow-1);
addlabel(yes,"ADR: " + Round(100*(ADR_highlow-1)), color.blue);
plot scan = Round(100*(ADR_highlow-1)) > 4.5 ;