Here's what I use... There is a label option if you wish to change the colorDoes anyone have an ATR Label I can add to the chart
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);
Tom, I still cannot figure out how to get this to update throughout the day. Any suggestions?
def o = open; def h = high; def l = low; def c = close;
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.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.
# ------ START CODE input ATRPeriod = 20; #Hint ATRPeriod: The ATR period for previous days, default 14. def period = AggregationPeriod.DAY; def ATR = MovingAverage(AverageType.WILDERS, TrueRange(high(period = period), close(period = period), low(period = period)), ATRperiod); def showATralways = yes; def dayrng = Round((high(period = AggregationPeriod.DAY) - low(period = AggregationPeriod.DAY)),2); AddLabel(showATRalways, "DayRng: " + dayrng + " vs. ATR: " + Round(ATR,2) + " (" + Round(((dayrng/ATR)*100),2) +"%)" , color.green); # ------- END CODE
input ATRLength = 14; def ATR = Round(Average(TrueRange(high, close, low), ATRLength), 2); AddLabel(yes, Concat("ATR=", ATR), Color.YELLOW);
Try this. You can change the length and turn off want you do not want through the input.I am sure this is a simple one, but I am struggling today. Working on cleaning up my charts.
I use the out of the box on Thinkorswim ATR study (ATR: 5, Wilders drawn as lines on lower axis) to determine the range of the last 5 candles on my 5 min. chart. Can someone help / share a code to have this shown as a label only (not as study shown). Thank you
Declare upper; input length = 14; plot currentATR = reference ATR(length, averageType = AverageType.wilders); currentATR.Hide(); def up= 2.6; def dn = 1.5; def atrlow = currentatr > dn; def atrhigh = currentatr > up; AddLabel(yes, Concat(currentatr , Concat(" ", if atrhigh then "8 ticks" else if atrlow then "4 ticks" else "NO TRADES")), if atrhigh then Color.GREEN else if atrlow then Color.LIGHT_gray else Color.WHITE);
|Thread starter||Similar threads||Forum||Replies||Date|
|J||ATR Scanner Setup||Questions||0|
|S||Creating ATR and Gap labels||Questions||2|
|ATR Trailing Stop (5atr period.1.5 factor) crossing 50period moving average with Alarm||Questions||0|
|Best ATR ADR Indicator I came up with today (with %)||Indicators||0|
|T||Simple ATR Trailing Stop Not Working||Questions||6|