Candle or Label color change for ATR

JMath3

New member
VIP
Hi,
Can someone help me with adding additional coding to add color to either the color or on the label to indicate when ATR is met for the day, week and month? I would appreciate it. Not much of a coder..

Thanks


Code:
input length = 14;
input averageType = AverageType.WILDERS;
input week_period = aggregationperiod.week;


def ATR_day = if week_period >= aggregationperiod.min then MovingAverage(averageType, TrueRange(high(period = week_period), close(period = week_period), low(period = week_period)), length) else double.nan;

plot labelColor = 1; # only to pull in color select widget
labelColor.setHiding(1) ; #never want to show this
labelColor.hideBubble();
labelColor.hideTitle();
labelColor.setDefaultColor(color.PLUM);


AddLabel(week_period >= aggregationperiod.min, Concat(if week_period == aggregationperiod.day then "Daily ATR: " else if week_period == aggregationperiod.week then "Weekly ATR: " else if week_period == aggregationperiod.month then "Monthly ATR: " else "", ATR_day), labelColor.takeValueColor() );
 

Similar threads

Top