KT HMA
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nik0580

//@version=5
indicator(title='KT HMA', overlay=true)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// High - Lows
plotshape(close > high[1],style=shape.triangleup,location=location.abovebar, color=color.red,text="H",size=size.tiny)
plotshape(close < low[1], style=shape.triangledown,location=location.belowbar, color=color.blue,text="L",size=size.tiny)

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//HMA
lengthhma = input.int(88, minval=1,title = "Length")
srchma = input(close, title="Source")
hullma = ta.wma(2*ta.wma(srchma, lengthhma/2)-ta.wma(srchma, lengthhma), math.floor(math.sqrt(lengthhma)))
hullColor =  hullma > hullma[2] ?  color.green : #ff0000  
plot(hullma, title='HULL', color= hullColor,linewidth=4,style=plot.style_stepline)

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ATR
lengthATR = input.int(13, minval=1,title ='ATR')
mult = input(1.0, 'Multiplier')
src = input(close, title='Source')

ma = ta.ema(src, lengthATR)
mahigh = plot(ta.ema(high, lengthATR), color=color.new(#2962FF, 0), title='High')
malow = plot(ta.ema(low, lengthATR), color=color.new(#2962FF, 0), title='Low')
fill(malow, mahigh, title='MA Fill', color=color.new(color.yellow, 50))

rangema = ta.atr(lengthATR) 
upper = ma + rangema * mult
lower = ma - rangema * mult
upper2 = ma + rangema * mult * 2
lower2 = ma - rangema * mult * 2
upper3 = ma + rangema * mult * 3
lower3 = ma - rangema * mult * 3

plot(ma, color=color.blue, title='Base')
u2 = plot(upper2, color=color.blue, title='2 ATR Up')
l2 = plot(lower2, color=color.blue, title='2 ATR Down')
u3 = plot(upper3, color=color.blue, title='3 ATR Up')
l3 = plot(lower3, color=color.blue, title='3 ATR Down')
fill(u2, u3, color=color.new(color.red, 70), title='3 ATR Up')
fill(l2, l3, color=color.new(color.red, 70), title='3 ATR Down')
