Doji-creators
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © snktshrma

//@version=5
indicator("Doji-creators", overlay = true)

var box hiLoBox = na
var box hiLBox = na
pips = input.float(1,minval=0.1,title="Pips")
candles = input.int(5,minval=1,title="Candle")
reward = input.int(1,minval=1,title="Reward")
Precision = input.float(0.1, minval=0.0001, title="Precision")
barcolor(math.abs(open[1] - close[1]) <= (high[1] - low[1]) * Precision and (close >= high[1] or close <= low[1]) ? color.yellow : na,0,false)
if (math.abs(open[1] - close[1]) <= (high[1] - low[1]) * Precision and (close >= high[1]))

    hiLoBox := box.new(bar_index[1], (high + (high - low[1])*reward), bar_index+candles, high, border_color = na, bgcolor = color.new(color.green,60))
    hiLBox := box.new(bar_index[1], high, bar_index+candles, low[1]-pips, border_color = na, bgcolor = color.new(color.red,60))
    alert("Doji breakout upside", alert.freq_once_per_bar_close)
    
else if (math.abs(open[1] - close[1]) <= (high[1] - low[1]) * Precision and (close <= low[1]))

    hiLoBox := box.new(bar_index[1], low, bar_index+candles, (low + (low - high[1])*reward), border_color = na, bgcolor = color.new(color.green,60))
    hiLBox := box.new(bar_index[1], high[1]+pips, bar_index+candles, low, border_color = na, bgcolor = color.new(color.red,60))
    alert("Doji breakout down", alert.freq_once_per_bar_close)
    

