OG Bubba Knox
New member
Hi All,
I have this code where assignBackgroundColor is not working as expected. Here is the entire script:
It is code for a watchlist column. It should color the background of the cell green if the volatility is relatively low and black if volatility is relatively high... this part is not working, the colors are not applied and I have no clue what is wrong with the syntax.
Thanks!!
I have this code where assignBackgroundColor is not working as expected. Here is the entire script:
Code:
input price = CLOSE;
input length = 14;
def Earnings = AbsValue(GetEventOffset(Events.Earnings, 0));
def BBWidth = BollingerBandwidth(AverageType.Exponential, price, 0, length, -2.2, 2.2); #needs to bee BB width
def AvgVol = MovingAverage(AverageType.Simple,BBWidth,20);
plot NextEarnings = if isNaN(Earnings)then 0 else Earnings;
assignBackgroundColor(if BBWidth > AvgVol then color.black else color.green);
It is code for a watchlist column. It should color the background of the cell green if the volatility is relatively low and black if volatility is relatively high... this part is not working, the colors are not applied and I have no clue what is wrong with the syntax.
Thanks!!