Simplified candlesticks
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © romanlosevdelfi

//@version=5
indicator("Simplified candlesticks", overlay=true)

slow_ema = ta.ema(close, 21)
fast_ema = ta.ema(close, 8)
veryslow_ema = ta.ema(close, 100)

//plot(slow_ema, color=color.red)
//plot(fast_ema, color=color.blue)
//plot(veryslow_ema, color=color.yellow)

current_bar_size_ww = high - low
current_bar_size = math.max(close, open) - math.min(close, open)

look_back = 60


bar_sizes = 0.0

bar_sizes_avg = 0.0
current_bar_size_m = 0.0
current_bar_size_a = 0.0
for offset = 1 to look_back

    current_bar_size_a := math.max(close[offset], open[offset]) - math.min(close[offset], open[offset])
    bar_sizes := bar_sizes + current_bar_size_a
    if(current_bar_size_a > current_bar_size_m)
        current_bar_size_m := current_bar_size_a
    
bar_sizes_avg := bar_sizes / look_back



bar_sizes_ww_avg = 0.0
current_bar_size_ww_m = 0.0
current_bar_size_ww_a = 0.0
for offset = 1 to look_back

    current_bar_size_ww_a :=high[offset] - low[offset]
    bar_sizes := bar_sizes + current_bar_size_ww_a
    if(current_bar_size_ww_a > current_bar_size_ww_m)
        current_bar_size_ww_m := current_bar_size_ww_a

bar_sizes_ww_avg := bar_sizes / look_back
//plot(veryslow_ema)
//plot(slow_ema, color=color.green)

//current_bar_size > bar_sizes_avg * 2.5 and 
//plot(current_bar_size)
//plot(current_bar_size_m, color=color.red)
current_bar_highest = current_bar_size > current_bar_size_m * 1.5 ? true : false
small_wicks = current_bar_size / current_bar_size_ww > 0.7 ? true : false

verybig_wicks = current_bar_size / current_bar_size_ww < 0.1 ? true : false

//bullish long stickbar
plotshape(current_bar_highest and small_wicks and close > open and slow_ema > veryslow_ema, color = color.green, style = shape.arrowup, text = "Continuation LS")
plotshape(current_bar_highest and small_wicks and close > open and slow_ema < veryslow_ema and fast_ema > slow_ema, color = color.green, style = shape.arrowup, text = "Reversal LS")

plotshape(current_bar_highest and small_wicks and close < open and slow_ema < veryslow_ema, color = color.red, style = shape.arrowdown, text = "Continuation LS", location = location.belowbar)
plotshape(current_bar_highest and small_wicks and close < open and slow_ema > veryslow_ema and fast_ema < slow_ema, color = color.red, style = shape.arrowdown, text = "Reversal LS", location = location.belowbar)








upper_wick_size = high - math.max(open, close)
bottom_wick_size = math.min(open, close) - low
big_wicks_upper = upper_wick_size / current_bar_size_ww > 0.2 and upper_wick_size / current_bar_size_ww < 0.4 ? true : false
big_wicks_bottom = bottom_wick_size / current_bar_size_ww > 0.2 and bottom_wick_size / current_bar_size_ww < 0.4 ? true : false



no_wicks_upper = upper_wick_size / current_bar_size_ww < 0.1 ? true : false
no_wicks_bottom = bottom_wick_size / current_bar_size_ww < 0.1 ? true : false

plotshape(big_wicks_upper and big_wicks_bottom and current_bar_size_ww > bar_sizes_ww_avg * 1.7, color = color.yellow, style = shape.arrowup, text = "Possible consolidation", location = location.belowbar )

biger_wicks_upper = upper_wick_size / current_bar_size_ww > 0.4 and upper_wick_size / current_bar_size_ww < 0.6 ? true : false

plotshape(biger_wicks_upper and no_wicks_bottom and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close > open and close[1] < open, color = color.yellow, style = shape.arrowup, text = "Bulls weakness", location = location.abovebar )
plotshape(biger_wicks_upper and no_wicks_bottom and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close > open and close[1] > open and fast_ema < slow_ema and slow_ema > veryslow_ema, color = color.red, style = shape.arrowup, text = "Bulls weakness / Reversal", location = location.belowbar )

biger_wicks_bottom = bottom_wick_size / current_bar_size_ww > 0.4 and bottom_wick_size / current_bar_size_ww < 0.6 ? true : false

plotshape(biger_wicks_bottom and no_wicks_upper and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close < open and close[1] > open, color = color.yellow, style = shape.arrowup, text = "Bears weakness", location = location.abovebar )
plotshape(biger_wicks_bottom and no_wicks_upper and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and close < open and close[1] < open and fast_ema > slow_ema and slow_ema < veryslow_ema, color = color.green, style = shape.arrowup, text = "Bears weakness / Reversal", location = location.belowbar )




plotshape(upper_wick_size / current_bar_size_ww > 0.4 and bottom_wick_size / current_bar_size_ww > 0.4 and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and slow_ema > veryslow_ema , color = color.purple, style = shape.arrowup, text = "Doji", location = location.abovebar )
plotshape(upper_wick_size / current_bar_size_ww > 0.4 and bottom_wick_size / current_bar_size_ww > 0.4 and current_bar_size_ww > bar_sizes_ww_avg * 1.5 and slow_ema < veryslow_ema , color = color.purple, style = shape.arrowup, text = "Doji", location = location.belowbar )


