Hello, I am trying to create a candle color bar when the ATR is greater than 2 times the avg. ATR, I have to code already but candles are all colored yellow, Am i Doing something wrong here? It must be just something stupid small because the logic is okay.
Code:
#
def atr = Average(TrueRange(high, close, low), 14);
def twoatr = (atr*2);
def atrBar = if twoatr then 1 else Double.NaN;
AddLabel(yes,"ATR = " + Round(atr,2),Color.YELLOW);
AddLabel(yes,"ATR*2 = " + Round(twoatr,2),Color.YELLOW);
AssignPriceColor(if close > atrbar then Color.YELLOW else Color.CURRENT );