OPEN-SOURCE SCRIPT

MultipSMMA 5-9-13-21-35-50-100 @trueenight

//version=4
study("MultipSMMA 5-9-13-21-35-50-100", overlay = true)
getSma(src, len) =>
float smma = 0.0000000
// len = input(7, minval=1, title="Length")
// src = input(close, title="Source")
smma := na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
//plot(smma, color=color.red)
smma

plot(getSma(close, input(5, "Sma 5 ")),"sma5", color=#ff0000)
plot(getSma(close, input(9, "Sma 9 ")),"sma9", color=#ff4d00)
plot(getSma(close, input(13, "Sma 13 ")),"sma13", color=#ff9800)
// plot(sma18,"sma18", color=color.green)
plot(getSma(close, input(21, "Sma 21 ")),"sma21", color=#c27ba0, linewidth=3)
plot(getSma(close, input(35, "Sma 35 ")),"sma35", color=#00ffff)
plot(getSma(close, input(50, "Sma 50 ")),"sma50", color=#ff00ff, linewidth=3)
plot(getSma(close, input(100, "Sma 100 ")),"sma100", color=color.yellow, linewidth=3)
Moving Averages

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer