OPEN-SOURCE SCRIPT

MA 20, 50, 200

//version=5
indicator("MA 20, 50, 100", overlay=true)

// Calculate the 20-period, 50-period, and 100-period Simple Moving Averages
ma20 = ta.sma(close, 20)
ma50 = ta.sma(close, 50)
ma100 = ta.sma(close, 200)

// Plot the moving averages on the chart
plot(ma20, color=color.red, linewidth=2, title="MA 20")
plot(ma50, color=color.green, linewidth=2, title="MA 50")
plot(ma100, color=color.blue, linewidth=2, title="MA 200")
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?

Disclaimer