Gap Finder
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © the_zoro

//@version=5
indicator("Gap Finder", overlay=false)

threshold_min = input.int(4, "Min. Gap (%)", minval=0, maxval=100, step=1)
threshold_max = input.int(10, "Max. Gap (%)", minval=0, maxval=100, step=1)

comp1 = open
comp2 = close[1]

diff = math.abs(comp1-comp2)
gap_perc = (diff/close)*100

plot(gap_perc > threshold_min and gap_perc < threshold_max ? 1 : 0, style=plot.style_histogram)