Moving Averages Selection
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © fabio11fcv

//@version=5
indicator("Moving Averages Selection", overlay = true, timeframe = "")
ema1lenght = input.int(defval = 45,title = "EMA1")
ema1 = ta.ema(close,ema1lenght)

ema2lenght = input.int(defval = 90,title = "EMA2")
ema2 = ta.ema(close,ema2lenght)

ema3lenght = input.int(defval = 180,title = "EMA3")
ema3 = ta.ema(close,ema3lenght)

sma1lenght = input.int(defval = 45,title = "SMA1")
sma1 = ta.sma(close,sma1lenght)

sma2lenght = input.int(defval = 90,title = "SMA2")
sma2 = ta.sma(close, sma2lenght)

sma3lenght = input.int(defval = 180,title = "SMA3")
sma3 = ta.sma(close,sma3lenght)

hma1lenght = input.int(defval = 45,title = "HMA1")
hma1 = ta.hma(close,hma1lenght)

hma2lenght = input.int(defval = 90,title = "HMA2")
hma2 = ta.hma(close,hma2lenght)

hma3lenght = input.int(defval = 180,title = "HMA3")
hma3 = ta.hma(close,hma3lenght)

rma1lenght = input.int(defval = 45,title = "RMA1")
rma1 = ta.rma(close,rma1lenght)

rma2lenght = input.int(defval = 90,title = "RMA2")
rma2 = ta.rma(close,rma2lenght)

rma3lenght = input.int(defval = 180,title = "RMA3")
rma3 = ta.rma(close,rma3lenght)

wma1lenght = input.int(defval = 45,title = "WMA1")
wma1 = ta.wma(close,wma1lenght)

wma2lenght = input.int(defval = 90,title = "WMA2")
wma2 = ta.wma(close,wma2lenght)

wma3lenght = input.int(defval = 180,title = "WMA3")
wma3 = ta.wma(close,wma3lenght)

Length1 = input.int(45, title = "kAMA1")
xPrice1 = close
xvnoise1 = math.abs(xPrice1 - xPrice1[1])
nAMA1 = 0.0
nfastend1 = 0.666
nslowend1 = 0.0645
nsignal1 = math.abs(xPrice1 - xPrice1[Length1])
nnoise1 = math.sum(xvnoise1, Length1)
nefratio1 = nnoise1 != 0 ? nsignal1 / nnoise1 : 0
nsmooth1 = math.pow(nefratio1 * (nfastend1 - nslowend1) + nslowend1, 2)
nAMA1 := nz(nAMA1[1]) + nsmooth1 * (xPrice1 - nz(nAMA1[1]))

Length2 = input.int(90, title = "kAMA2")
xPrice2 = close
xvnoise2 = math.abs(xPrice2 - xPrice2[1])
nAMA2 = 0.0
nfastend2 = 0.666
nslowend2 = 0.0645
nsignal2 = math.abs(xPrice2 - xPrice2[Length2])
nnoise2 = math.sum(xvnoise2, Length2)
nefratio2 = nnoise2 != 0 ? nsignal2 / nnoise2 : 0
nsmooth2 = math.pow(nefratio2 * (nfastend2 - nslowend2) + nslowend2, 2)
nAMA2 := nz(nAMA2[1]) + nsmooth2 * (xPrice2 - nz(nAMA2[1]))

Length3 = input.int(180, title = "kAMA3")
xPrice3 = close
xvnoise3 = math.abs(xPrice3 - xPrice3[1])
nAMA3 = 0.0
nfastend3 = 0.666
nslowend3 = 0.0645
nsignal3 = math.abs(xPrice3 - xPrice3[Length3])
nnoise3 = math.sum(xvnoise3, Length3)
nefratio3 = nnoise3 != 0 ? nsignal3 / nnoise3 : 0
nsmooth3 = math.pow(nefratio3 * (nfastend3 - nslowend3) + nslowend3, 2)
nAMA3 := nz(nAMA3[1]) + nsmooth3 * (xPrice3 - nz(nAMA3[1]))


plot(ema1,"EMA1",color = color.rgb(50,50,50,0))
plot(ema2,"EMA2",color = color.rgb(55,55,55,0))
plot(ema3,"EMA3",color = color.rgb(60,60,60,0))
plot(sma1,"SMA1",color = color.rgb(65,65,65,0))
plot(sma2,"SMA2",color = color.rgb(70,70,70,0))
plot(sma3,"SMA3",color = color.rgb(75,75,75,0))
plot(hma1,"HMA1",color = color.rgb(80,80,80,0))
plot(hma2,"HMA2",color = color.rgb(85,85,85,0))
plot(hma3,"HMA3",color = color.rgb(90,90,90,0))
plot(rma1,"RMA1",color = color.rgb(95,95,95,0))
plot(rma2,"RMA2",color = color.rgb(100,100,100,0))
plot(rma3,"RMA3",color = color.rgb(110,110,110,0))
plot(wma1,"WMA1",color = color.rgb(120,120,120,0))
plot(wma2,"WMA2",color = color.rgb(130,130,130,0))
plot(wma3,"WMA3",color = color.rgb(140,140,140,0))
plot(nAMA1,"KAMA1",color = color.rgb(150,150,150,0))
plot(nAMA2,"KAMA2",color = color.rgb(160,160,160,0))
plot(nAMA3,"KAMA3",color = color.rgb(170,170,170,0))