I need help with coloring volume bar another color when a doji shows up
I've tried multiple ways, but can't get the logic right
The picture shows a dot above the volume bar representing the candlestick Doji in the price graph
Instead of a dot I would like the volume bar to be a different color like white etc...
I've tried multiple ways, but can't get the logic right
The picture shows a dot above the volume bar representing the candlestick Doji in the price graph
Instead of a dot I would like the volume bar to be a different color like white etc...
Code:
#Doji
input length = 20;
input bodyFactor = 0.05;
assert(bodyFactor >= 0, "'body factor' must not be negative: " + bodyFactor);
plot Doji = IsDoji(length, bodyFactor) and RelativeVolumeStDev(50).RelVol >= 2;
Doji.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Doji.SetDefaultColor(CreateColor(153, 153, 255));
Doji.SetLineWeight(3);
#RelVol
declare lower;
declare zerobase;
input length2 = 60;
input numDev = 2.0;
input allowNegativeValues = no;
def rawRelVol = (volume - Average(volume, length2)) / StDev(volume, length2);
plot RelVol = if allowNegativeValues then rawRelVol else Max(0, rawRelVol);
plot StDevLevel = numDev;
RelVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
RelVol.SetLineWeight(3);
RelVol.DefineColor("Above", GetColor(0));
RelVol.DefineColor("Below", GetColor(2));
RelVol.AssignValueColor(if RelVol >= numDev then RelVol.Color("Above") else RelVol.Color("Below"));
StDevLevel.SetDefaultColor(GetColor(7));
StDevLevel.SetStyle(Curve.SHORT_DASH);
Last edited: