J
jayabner
Guest
Hi there, so I'm new to using thinkscript and I was wondering if anyone could help me merge these ATR labels (for Daily, Weekly, and Monthly) into one single label instead of 3 separate ones to appear at the top left corner of thinkorswim chart. Any and all help is appreciated! Thank you in advance
input length = 14;
input averageType = AverageType.WILDERS;
input agg1 = AggregationPeriod.DAY;
input agg2 = AggregationPeriod.WEEK;
input agg3 = AggregationPeriod.MONTH;
def h1 = high(period = agg1);
def c1 = close(period = agg1);
def l1 = low(period = agg1);
def h2 = high(period = agg2);
def c2 = close(period = agg2);
def l2 = low(period = agg2);
def h3 = high(period = agg3);
def c3 = close(period = agg3);
def l3 = low(period = agg3);
def ATR1 = MovingAverage(averageType, TrueRange(h1, c1, l1), length);
def ATR2 = MovingAverage(averageType, TrueRange(h2, c2, l2), length);
def ATR3 = MovingAverage(averageType, TrueRange(h3, c3, l3), length);
addlabel(1,"D ATR: " + astext(ATR1), color.yellow);
addlabel(1,"W ATR: " + astext(ATR2), color.yellow);
addlabel(1,"M ATR: " + astext(ATR3), color.yellow);
input length = 14;
input averageType = AverageType.WILDERS;
input agg1 = AggregationPeriod.DAY;
input agg2 = AggregationPeriod.WEEK;
input agg3 = AggregationPeriod.MONTH;
def h1 = high(period = agg1);
def c1 = close(period = agg1);
def l1 = low(period = agg1);
def h2 = high(period = agg2);
def c2 = close(period = agg2);
def l2 = low(period = agg2);
def h3 = high(period = agg3);
def c3 = close(period = agg3);
def l3 = low(period = agg3);
def ATR1 = MovingAverage(averageType, TrueRange(h1, c1, l1), length);
def ATR2 = MovingAverage(averageType, TrueRange(h2, c2, l2), length);
def ATR3 = MovingAverage(averageType, TrueRange(h3, c3, l3), length);
addlabel(1,"D ATR: " + astext(ATR1), color.yellow);
addlabel(1,"W ATR: " + astext(ATR2), color.yellow);
addlabel(1,"M ATR: " + astext(ATR3), color.yellow);