#Day Lines##############################
def AP = AggregationPeriod.DAY;
plot D_Open = open(period = AP);
D_Open.SetDefaultColor(color.yellow);
D_Open.SetPaintingStrategy(PaintingStrategy.POINTS);
D_Open.SetLineWeight(2);
D_Open.HideTitle();
plot D_High = high(period = AP);
D_High.SetDefaultColor(color.green);
D_High.SetPaintingStrategy(PaintingStrategy.POINTS);
D_High.SetLineWeight(2);
D_High.HideTitle();
plot D_Low = low(period = AP);
D_Low.SetDefaultColor(color.red);
D_Low.SetPaintingStrategy(PaintingStrategy.POINTS);
D_Low.SetLineWeight(2);
D_Low.HideTitle();
input AtrLngth = 14;
def tr = TrueRange (high(period = ap), close(period = ap), low(period = ap));
def AtrA = Round(ExpAverage(tr, AtrLngth), 2);
def Atr = atra[1];
def uatr = high(period = AP)+ (atr-tr);
def datr = low(period = AP)- (atr-tr);
plot atru = (if uatr <= D_open then double.nan else uatr);
atru.SetDefaultColor(color.yellow);
atru.SetPaintingStrategy(PaintingStrategy.DASHES);
atru.SetLineWeight(3);
atru.HideTitle();
plot atrd = (if datr >= D_Open then double.nan else datr);
atrd.SetDefaultColor(color.yellow);
atrd.SetPaintingStrategy(PaintingStrategy.DASHES);
atrd.SetLineWeight(3);
atrd.HideTitle();
Addlabel(yes,"ATR_Length:" + ATRLngth + " ATR: " + atr + " TR: " + tr + " Remainder: " + round((atr-tr),2),color.yellow);