Percent Research
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © shaaah10

//@version=5
indicator("Percent Research", overlay = false)

inputPrice = input.float(defval = 5, minval = 0, title = "Price")

inputUp = input.float(defval = 20, minval = 0, title="Change % Up")
inputDown = input.float(defval = -20, maxval = 0, title = "Change % Down")
inputInterval = input(defval = 5, title = "Change Interval")
valueCalc = close/close[inputInterval]

valueVolume = input.float(defval = 100000, title = "Volume")
intervalVolume = input(defval = 3, title = "Volume Interval")
minVolume = ta.lowest(volume, intervalVolume)

valColor = if ((valueCalc >= (inputUp/100)+1) and (minVolume >= valueVolume) and (close >= inputPrice))
    color.green
else if ((valueCalc <= (inputDown/100)+1) and (minVolume >= valueVolume) and (close >= inputPrice))
    color.red
else
    na

plot(series=1, style=plot.style_area, color=valColor)