MACD-V Volatility Normalized Momentum
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Mik3Christ3ns3n

//@version=5
indicator(title="MACD-V Volatility Normalized Momentum", shorttitle="MACD-V", timeframe="", timeframe_gaps=true)
// Getting inputs
fast_length = input(title="Fast Length", defval=12)
slow_length = input(title="Slow Length", defval=26)
atr_length  = input(title="ATR Length", defval=26)
src = input(title="Source", defval=close)

// Plot colors
col_macd = input(#FF6D00, "MACD-V Line  ", group="Color Settings", inline="MACD-V")

// [( 12 bar EMA - 26 bar EMA) / ATR(26) ] * 100
fast_ma = ta.ema(src, fast_length)
slow_ma = ta.ema(src, slow_length)
atr = ta.atr(atr_length)
macd = fast_ma - slow_ma
macdv = (macd / atr) * 100
plot(macdv, title="MACD-V", color=col_macd)

band1 = hline(150, "Upper Band", color=#787B86)
bandm = hline(0, "Middle Band", color=color.new(#787B86, 50))
band0 = hline(-150, "Lower Band", color=#787B86)
fill(band1, band0, color=color.rgb(120, 123, 134, 90), title="Background")
