lucian_dinu 2 Posted yesterday at 01:18 PM The Think or Swim / TOS Script /Code bellow will display a label into the volume box, showing the value of Daily ATR versus current Day ATR and % of the Daily ATR achieved in the current session / Day. Pictures attached for reference. Bellow are two versions of the script 1. Label is GREY under 70% DATR , Turns Green over 70% of the DATR, tuns RED over 100% DATR 2. Label is GERY under 70% DATR , Turns Green over 70% of the DATR 1.st Version -------Label is GREY under 70% DATR , Turns Green over 70% of the DATR, tuns RED over 100% DATR # ---------------------------------------------------------- # DATR vs Today-ATR – volume-pane label # DATR = 14-day Wilders-smoothed TrueRange from DAILY bars # ATS = today’s intraday High – Low # ---------------------------------------------------------- declare on_volume; input dailyATRLength = 14; input averageType = AverageType.WILDERS; # ---------- Daily ATR (computed from daily bars) ---------- def dailyTR = TrueRange( high(period = AggregationPeriod.DAY), close(period = AggregationPeriod.DAY), low(period = AggregationPeriod.DAY) ); def dailyATR = MovingAverage(averageType, dailyTR, dailyATRLength); # ---------- Today’s session range ---------- def todayHi = high(period = AggregationPeriod.DAY); def todayLo = low(period = AggregationPeriod.DAY); def todayATR = todayHi - todayLo; # ---------- Percentage ---------- def pct = if dailyATR != 0 then Round((todayATR / dailyATR) * 100, 1) else 0; # ---------- Label ---------- AddLabel( yes, "DATR " + Round(dailyATR, 2) + " vs ATR " + Round(todayATR, 2) + " (" + pct + "%)", if pct >= 100 then Color.GREEN else if pct >= 70 then Color.YELLOW else Color.GRAY ); 2.nd Version ------- Label is GERY under 70% DATR , Turns Green over 70% of the DATR # ---------------------------------------------------------- # DATR vs Today-ATR – volume-pane label # DATR = 14-day Wilders-smoothed TrueRange from DAILY bars # ATS = today’s intraday High – Low # ---------------------------------------------------------- declare on_volume; input dailyATRLength = 14; input averageType = AverageType.WILDERS; # ---------- Daily ATR (computed from daily bars) ---------- def dailyTR = TrueRange( high(period = AggregationPeriod.DAY), close(period = AggregationPeriod.DAY), low(period = AggregationPeriod.DAY) ); def dailyATR = MovingAverage(averageType, dailyTR, dailyATRLength); # ---------- Today’s session range ---------- def todayHi = high(period = AggregationPeriod.DAY); def todayLo = low(period = AggregationPeriod.DAY); def todayATR = todayHi - todayLo; # ---------- Percentage ---------- def pct = if dailyATR != 0 then Round((todayATR / dailyATR) * 100, 1) else 0; # ---------- Label ---------- AddLabel( yes, "DATR " + Round(dailyATR, 2) + " vs ATR " + Round(todayATR, 2) + " (" + pct + "%)", if pct >= 70 then Color.GREEN else Color.GRAY ); Share this post Link to post Share on other sites