akoetraolrkhoecrxhifbyf

MA of MAs [nostdal.duckdns.org]

Draws the average moving average of several moving averages (averageception)
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
// Modifications of ChrisMoody's "CM_Ultimate_MA_MTF" script
// Draws the average moving average of several moving averages (averageception)

study(title="MA of MAs [nostdal.duckdns.org]", shorttitle="MA of MAs [nostdal.duckdns.org]", overlay=true)

// Inputs
src = close
useCurrentRes = input(true, title="Use Current Chart Resolution?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="D")
len = input(20, title="Moving Average Length - LookBack Period")
cc = input(true, title="Change Color Based On Direction?")
smoothe = input(2, minval=1, maxval=10, title="Color Smoothing - 1 = No Smoothing")


res = useCurrentRes ? period : resCustom

hullma = wma(2 * wma(src, len / 2) - wma(src, len), round(sqrt(len)))

ema1 = ema(src, len)
ema2 = ema(ema1, len)
ema3 = ema(ema2, len)
tema = 3 * (ema1 - ema2) + ema3

avg = (sma(src, len) + ema(src, len) + wma(src, len) + hullma + vwma(src, len) + rma(src, len)) / 6


out = security(tickerid, res, avg)
ma_up = out >= out[smoothe]
ma_down = out < out[smoothe]
col = cc ? ma_up ? #006600 : ma_down ? #660000 : aqua : aqua
plot(out, title="MA of MAs", style=line, linewidth=4, color = col)