I found the source of this bug - the color assignment doesn't have a case where it handles doji candles, so it falls through to coloring them as GetColor(1). On a dark chart, GetColor(1) is COLOR.CYAN, which is the same color used for UP3.Trying to debug an anomaly in this script where a cyan bar(up3) is being printed even though its not exceeding the volAvg.
Code:def up3 = if IR_BODYG and (Vol > VolAvg) then 1 else 0;
Any ideas?
The below code colors them YELLOW instead and also has a mod to allow for user selectable average type and length to use for volume. The original indicator was using a 12 period exponential average.
Ruby:
AddLabel(yes, "Day_volume: " + volume (period = "DAY" ), Color.LIGHT_GRAY);
AddLabel(yes, "volume: " + volume, Color.white);
declare lower;
declare zerobase;
input averageType = averagetype.Exponential;
input averageLength = 12;
plot Vol = volume;
plot VolAvg = MovingAverage(averageType,volume,averageLength);
VolAvg .SetPaintingStrategy(PaintingStrategy.squared_HISTOGRAM);
VolAvg .SetDefaultColor(Color.GRAY);
def BODY_RANGE = max(oPEN,cLOSE) - min(oPEN,cLOSE);
plot IR_BODY = if BODY_RANGE < BODY_RANGE[1] and volume > volume[1] then 1 else 0 ;
def IR_BODYG = if IR_BODY and close>open then 1 else 0;
def IR_BODYR = if IR_BODY and close<open then 1 else 0;
Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.DefineColor("Up", Color.green);
Vol.DefineColor("Down", Color.red);
Vol.DefineColor("Up2", Color.light_green);
Vol.DefineColor("Down2", Color.dark_ORANGE );
Vol.DefineColor("Up3", Color.cyan);
Vol.DefineColor("Up4", Color.blue);
Vol.DefineColor("Down3", Color.mAGENTA );
Vol.DefineColor("Down4", Color.plum );
Vol.AssignValueColor(
if close > open and IR_BODYG and Vol >VolAvg then Vol.color("Up3") else if
close > open and IR_BODYG then Vol.color("Up4")
else if close < open and IR_BODYR and Vol >VolAvg then Vol.color("Down3")
else if close < open and IR_BODYR then Vol.color("Down4")
else if close > open and Vol >VolAvg then Vol.color("Up")
else if close < open and Vol >VolAvg then Vol.color("Down")
else if close > open then Vol.color("Up2")
else if close < open then Vol.color("Down2")
else color.yellow);
input paintBars = yes;
DefineGlobalColor("CAM_UP", Color.GREEN);
DefineGlobalColor("CAM_UP2", Color.liGHT_GREEN);
DefineGlobalColor("CAM_UP3", Color.cyan);
DefineGlobalColor("CAM_UP4", Color.blue);
DefineGlobalColor("CAM_DN", Color.RED);
DefineGlobalColor("CAM_DN2", Color.darK_ORANGE );
DefineGlobalColor("CAM_DN3", Color.mAGENTA );
DefineGlobalColor("CAM_DN4", Color.plum );
AssignPriceColor(if !paintBars then Color.CURRENT
else if close > open and IR_BODYG and Vol >VolAvg then GlobalColor("CAM_UP3")
else if close < open and IR_BODYR and Vol >VolAvg then GlobalColor("CAM_DN3")
else if close > open and IR_BODYG then GlobalColor("CAM_UP4")
else if close < open and IR_BODYR then GlobalColor("CAM_DN4")
else if close > open and Vol >VolAvg then GlobalColor("CAM_UP")
else if close < open and Vol >VolAvg then GlobalColor("CAM_DN")
else if close > open then GlobalColor("CAM_UP2")
else if close < open then GlobalColor("CAM_DN2")
else Color.CURRENT);