How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# MA Marvel - MultiMA by AGPym

131 0
Multi-Moving Average in a single color changing indicator. Lines change color when they cross.
```// Created by AGPym
// Multi-Moving Average in a single color changing indicator
// Thanks to ChrisMoody for creating awesome scripts!
// Tips are appreciated!

study(title="MA Marvel - MultiMA by AGPym", shorttitle="MAMarvel", overlay=true)

//inputs
src = close
atype = input(1,minval=1,maxval=7,title="1=SMA, 2=EMA, 3=WMA, 4=HullMA, 5=VWMA, 6=RMA, 7=TEMA")

ma1 = input(25, title="1st Moving Average Period")
ma2 = input(50, title="2nd Moving Average Period")
ma3 = input(100, title="3rd Moving Average Period")
ma4 = input(200, title="4th Moving Average Period")
ma5 = input(500, title="5th Moving Average Period")
ma6 = input(1000, title="6th Moving Average Period. Changes color when above everything.")

//hull ma1 definition
hullma1 = wma(2*wma(src, ma1/2)-wma(src, ma1), round(sqrt(ma1)))
//TEMA definition
ema1ma1 = ema(src, ma1)
ema2ma1 = ema(ema1ma1, ma1)
ema3ma1 = ema(ema2ma1, ma1)
temama1 = 3 * (ema1ma1 - ema2ma1) + ema3ma1

avgma1 = atype == 1 ? sma(src,ma1) : atype == 2 ? ema(src,ma1) : atype == 3 ? wma(src,ma1) : atype == 4 ? hullma1 : atype == 5 ? vwma(src, ma1) : atype == 6 ? rma(src,ma1) : temama1

//hull ma2 definition
hullma2 = wma(2*wma(src, ma2/2)-wma(src, ma2), round(sqrt(ma2)))
//TEMA definition
ema1ma2 = ema(src, ma2)
ema2ma2 = ema(ema1ma2, ma2)
ema3ma2 = ema(ema2ma2, ma2)
temama2 = 3 * (ema1ma2 - ema2ma2) + ema3ma2

avgma2 = atype == 1 ? sma(src,ma2) : atype == 2 ? ema(src,ma2) : atype == 3 ? wma(src,ma2) : atype == 4 ? hullma2 : atype == 5 ? vwma(src, ma2) : atype == 6 ? rma(src,ma2) : temama2

//hull ma3 definition
hullma3 = wma(2*wma(src, ma3/2)-wma(src, ma3), round(sqrt(ma3)))
//TEMA definition
ema1ma3 = ema(src, ma3)
ema2ma3 = ema(ema1ma3, ma3)
ema3ma3 = ema(ema2ma3, ma3)
temama3 = 3 * (ema1ma3 - ema2ma3) + ema3ma3

avgma3 = atype == 1 ? sma(src,ma3) : atype == 2 ? ema(src,ma3) : atype == 3 ? wma(src,ma3) : atype == 4 ? hullma3 : atype == 5 ? vwma(src, ma3) : atype == 6 ? rma(src,ma3) : temama3

//hull ma4 definition
hullma4 = wma(2*wma(src, ma4/2)-wma(src, ma4), round(sqrt(ma4)))
//TEMA definition
ema1ma4 = ema(src, ma4)
ema2ma4 = ema(ema1ma4, ma4)
ema3ma4 = ema(ema2ma4, ma4)
temama4 = 3 * (ema1ma4 - ema2ma4) + ema3ma4

avgma4 = atype == 1 ? sma(src,ma4) : atype == 2 ? ema(src,ma4) : atype == 3 ? wma(src,ma4) : atype == 4 ? hullma4 : atype == 5 ? vwma(src, ma4) : atype == 6 ? rma(src,ma4) : temama4

//hull ma5 definition
hullma5 = wma(2*wma(src, ma5/2)-wma(src, ma5), round(sqrt(ma5)))
//TEMA definition
ema1ma5 = ema(src, ma5)
ema2ma5 = ema(ema1ma5, ma5)
ema3ma5 = ema(ema2ma5, ma5)
temama5 = 3 * (ema1ma5 - ema2ma5) + ema3ma5

avgma5 = atype == 1 ? sma(src,ma5) : atype == 2 ? ema(src,ma5) : atype == 3 ? wma(src,ma5) : atype == 4 ? hullma5 : atype == 5 ? vwma(src, ma5) : atype == 6 ? rma(src,ma5) : temama5

//hull ma6 definition
hullma6 = wma(2*wma(src, ma6/2)-wma(src, ma6), round(sqrt(ma6)))
//TEMA definition
ema1ma6 = ema(src, ma6)
ema2ma6 = ema(ema1ma6, ma6)
ema3ma6 = ema(ema2ma6, ma6)
temama6 = 3 * (ema1ma6 - ema2ma6) + ema3ma6

avgma6 = atype == 1 ? sma(src,ma6) : atype == 2 ? ema(src,ma6) : atype == 3 ? wma(src,ma6) : atype == 4 ? hullma6 : atype == 5 ? vwma(src, ma6) : atype == 6 ? rma(src,ma6) : temama6

plot(avgma1, title="MA1", style=line, color=(avgma1[0]>avgma2[1]? lime:red), linewidth=1, transp=60)
plot(avgma2, title="MA2", style=line, color=(avgma2[0]>avgma3[1]? lime:red), linewidth=2, transp=50)
plot(avgma3, title="MA3", style=line, color=(avgma3[0]>avgma4[1]? lime:red), linewidth=3, transp=40)
plot(avgma4, title="MA4", style=line, color=(avgma4[0]>avgma5[1]? lime:red), linewidth=3, transp=30)
plot(avgma5, title="MA5", style=line, color=(avgma5[0]>avgma6[1]? lime:red), linewidth=4, transp=20)
plot(avgma6, title="MA6", style=line, color=(avgma6[0]>avgma1[1] and avgma6[0]>avgma2[1] and avgma6[0]>avgma3[1] and avgma6[0]>avgma4[1] and avgma6[0]>avgma5[1]? lime:red), linewidth=4, transp=10)```
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter