PlotOHLC Color Bleed


How do I stop color bleed when using PlotOHLC?

PlotOHLC( x,x,0,x, "", IIf( x > 0, colorPaleGreen, colorPink ), styleCloud | styleNoLabel );


Many thanks

@Ron I think that this picture will better explain to other forum users what you are seeing:


Here, in the second pane, you can clearly see that the color "bleeding" is related to the horizontal center point of the standard bar size.

One way to visually overcome this effect is using the clipping style flag, like in this code snippet (that was used to plot the third pane in the image)

_roc = ROC(C, 1);
lowestVal = LowestVisibleValue( _roc ); 
highestVal = HighestVisibleValue( _roc ); 
// Plot Green half
PlotOHLC( _roc, _roc, 0, _roc, "", colorPaleGreen, styleCloud | styleNoLabel | styleClipMinMax, lowestVal, 0);
// Plot pink half
PlotOHLC( _roc, _roc, 0, _roc, "", colorPink, styleCloud| styleNoLabel | styleClipMinMax, 0, highestVal);

Maybe the change of colors in this case is visually nicer, but the original one is technically more correct!


That's excellent... thank you Beppe.

Out of interest what is the reason the original is more correct?

Many thanks for your help

1 Like

@Ron, check this post from @portfoliobuilder.

Here you are facing a similar situation. The vertices of the cloud chart are indicating a precise quotation, but the connecting lines (and colored areas) represent the transition from one value to another one. When you move from one positive to a negative quotation (or vice-versa), it is arbitrary to draw "the transition" area in green or red.

Making it half green/red or red/green is more close to what is known until you get the next quotation.
But probably this is just my opinion...

1 Like

Thank you very much beppe. Your code demo and explanation solved the same issue for me.

1 Like