Baekdoo multi OverSold OverBuy colored Candle
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © traderbaekdoosan

//@version=4
study("Baekdoo multi OverSold OverBuy colored Candle", overlay=true)

//stochastic slow
stoch_length = input(14, minval=1)
stoch_OverBought = input(80)
stoch_OverSold = input(20)

//RSI
RSI_length = input( 30 )
RSI_overSold = input( 30 )
RSI_overBought = input( 70 )

//CCI
cci_length = input(20, minval=1)
cci_src = input(hlc3, title="Source")
cci_ma = sma(cci_src, cci_length)
cci = (cci_src - cci_ma) / (0.015 * dev(cci_src, cci_length))
cci_overSold = input( -170 )
cci_overBought = input( 220 )

//Parabolic SAR
start = input(0.007)
increment = input(0.007)
maximum = input(0.09, "Max Value")
out = sar(start, increment, maximum)

AA=stoch(close, high, low, stoch_length) < stoch_OverSold ? 1 : 0
BB=rsi(close, RSI_length) < RSI_overSold ? 1 : 0
CC=cci < cci_overSold ? 1 : 0
DD=out > close ? 1 : 0
result_pos=AA+BB+CC+DD

barcolor(open<close and result_pos == 4 and volume > ema(volume, 78)/2  ? color.new(color.red, 0) : open<close and result_pos == 3 ? color.new(color.red, 25) : open<close and result_pos == 2 ? color.new(color.red, 50) : open<close and result_pos == 1? color.new(color.red, 75) : na)
plotshape(open<close and result_pos == 4 and volume > ema(volume, 78)/2 , style=shape.arrowup, color=#FF0000, location=location.belowbar, size=size.tiny)
plotshape(open<close and result_pos == 4 and volume > ema(volume, 78)/2 , text="OverSold", style=shape.labelup, color=#FF0000, textcolor=color.white, location=location.belowbar, size=size.tiny)

AAA=stoch(close, high, low, stoch_length) > stoch_OverBought ? 1 : 0
BBB=rsi(close, RSI_length) > RSI_overBought ? 1 : 0
CCC=cci > cci_overBought ? 1 : 0
DDD=out < close ? 1 : 0
result_neg=AAA+BBB+CCC+DDD

barcolor(open>close and result_neg == 4 and volume > ema(volume, 78)/2 ? color.new(color.blue, 0) : open>close and result_neg == 3 ? color.new(color.blue, 25) : open>close and result_neg == 2 ? color.new(color.blue, 50) : open>close and result_neg == 1? color.new(color.blue, 75) : na)
plotshape(open>close and result_neg == 4 and volume > ema(volume, 78)/2 , style=shape.arrowdown, color=#0000FF, location=location.abovebar, size=size.tiny)
plotshape(open>close and result_neg == 4 and volume > ema(volume, 78)/2 , text="OverBuy", style=shape.labeldown, color=#0000FF, textcolor=color.white, location=location.abovebar, size=size.tiny)