OPEN-SOURCE SCRIPT

Simple and Exponential Moving Averages

This script graphs 5 SMAs (20, 50, 100, 150, 200) and 5 EMAs (20, 50, 100, 150, 200). The first group uses blue and orange colors whereas the second one uses green and red. When a bar closes below a moving average, either orange or red will be used depending on which type of moving average and which period. In bullish mode, we show blue and green. Moving average periods are configurable, and you can hide the MAs you don't want.
Exponential Moving Average (EMA)EMASexponentialmaMoving AveragesribbonSimple Moving Average (SMA)sma

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