OPG Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © developdvb

//@version=5
indicator("OPG Indicator", overlay = true)

gapSize = float(((open - close[1]) / close[1]) * 100)
plotColor = color.new(color.white, 0)

minGapSize = float(input(defval = -0.03000, title = "Min Gap Size"))
maxGapSize = float(input(defval = 0.03000, title = "Max Gap Size"))

float plotData = 0.0

if gapSize > maxGapSize
    plotColor := color.new(color.red, 0)
    plotData := -gapSize
else if gapSize < minGapSize
    plotColor := color.new(color.green, 0)
    plotData := -gapSize

plotarrow(series = plotData, colorup = color.new(color.green, 0), colordown = color.new(color.red, 0))