ATR Gain
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © carlpwilliams2

//@version=5
indicator("ATR Gain")

gainUpperLimit = input.float(15, title="Gain Upper Limit", group="Limits")
gainLowerLimit = input.float(-15, title="Gain Lower Limit", group="Limits")

atr = ta.atr(14)
atrMA = ta.ema(atr,30)

atrGain = ((atr-atrMA)/atr)*100

upper = plot(gainUpperLimit, title="Gain Upper line", color=color.new(color.gray,60))
zero  = plot(0,title="Zero Line", color=color.gray)
lower = plot(gainLowerLimit, title="Gain lower line", color=color.new(color.gray,60))

fill(upper,lower,color.new(color.gray,80))
plot(atrGain, title="Volume Gain", color= color.blue, linewidth=2)