DTR vs ATR Indicator for ThinkorSwim

S

scottrades

New member
Does anyone have an ATR Label I can add to the chart
Here's what I use... There is a label option if you wish to change the color
Code:
input length2 = 14;
input ATRaverageType = AverageType.WILDERS;

def dailyHigh = high(period = “DAY”);
def dailyLow = low(period = “DAY”);
def dailyClose = close(period = “DAY”);

plot ATR = Round(MovingAverage(ATRaverageType, TrueRange(dailyHigh, dailyClose, dailyLow), length2));
#AddLabel(yes, “DATR: “+ATR, if ATR > 1.00 then Color.GREEN else if ATR > .50 then Color.YELLOW else Color.WHITE);
AddLabel(yes, Concat(“DATR= ”, ATR), Color.YELLOW);
 
S

scottrades

New member
@scottrades I've loaded that study on ROKU, the ATR Daily High is 142.66 and the ATR daily low is 128.68. Hence it does recalculate just fine
Tom, I still cannot figure out how to get this to update throughout the day. Any suggestions?
 
T

tomsk

Well-known member
VIP
Warehouse
Tom, I still cannot figure out how to get this to update throughout the day. Any suggestions?

My earlier posts on this thread (see post #9, #12, and #15) specifically specified in the header of the study that it was an ATR relative to the daily open. From your description sounds like all you need is to replace the secondary aggregation in the original code as follows. However in so doing you are changing the character of the study, and it won't be based on the daily open. Just be aware of that

Code:
def o = open;
def h = high;
def l = low;
def c = close;
 
Last edited:
S

scottrades

New member
My earlier posts on this thread (see post #9, #12, and #15) specifically specified in the header of the study that it was an ATR relative to the daily open.
I got that to mean it would calculate off the open, which is what I want. I'll make the change and see what it gives me. thank you.
 

Top