Colorize Large Candles// I have written a Pine Script to re-paint large candles in a different Color.
// You can set the value that you want to use to define what is 'Large', and the script will re-paint any candle whose size is equal to or greater than your value.
// The number can be an integer (8) or a decimal (7.5).
// You can enable the size measurement to be done in one of two ways: 1) either on the Body (Open-to-Close); 2) or on the Wicks (High-to-Low) of the candle.
// The color of the re-painted candle can be set independently for Up and for Down candles. You can also set any Opacity that you want for these candles.
// I usually set the limit for the Visibility to the Second- and Minute-timeframes, as the Script produces too many Colorized Bars when using the Hour- or Day- timeframes.
Paint
How To Color Prior BarsExample how to color the trigger bar of the condition and n-1 prior bars using only 1 barcolor() function.
Currently when offsets are used in barcolor(), bgcolor(), plot(), plotarrow(), plotchar(), or plotshape(), the offset only works with a simple (static) integer. If series (dynamic) integers are used instead, there is not an error, but the series values are ignored. Because of this limitation of offset being constrained to using only fixed offsets, the normal way to paint 3 Black Crows would be to use 3 barcolor() functions. Since there are a known number of bars to be painted in that scenario, this can be easily accomplished.
If a condition encompassed a variable length of n bars, then the number of barcolor() functions needed to use would be unknown. How to color the trigger bar of the condition and n-1 prior bars using only 1 barcolor() function? Dual examples below solves issue but requires n "future" bars, because of this it will not paint the most recent condition in realtime and may not be applicable for use in certain realtime situations. It paints similar in behavior to how a pivot does. Special thanks to LucF and RicardoSantos for illumination!
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
B3 HL2 Method Candle PainterThis script is similar to the "Hi-Lo" or "Clear" methods of painting bars. Instead of using the tips/edges of the candles like those two, the "(H+L)/2" method uses the change in (high+low)/2 to paint the bars. This gives you some similar results if you were to be binary with the candle coloring. However, my coloring scheme is not entirely binary. There are 5 possible colors:
HL2>LastHigh = Bright Green
HL2LastHL2 = Dull Green
HL2<LastHL2 = Dull Red
Bar Change (close - open) is going against the indicator = Gray
Free to share and enjoy!
~B3