OPEN-SOURCE SCRIPT

SMA Indicator (20, 50, 100)

SMA Script for 20,50 and 100 days

Key Features:
SMA Source:
Users can select the source for SMA calculation (e.g., close, open, high, low, hl2, etc.) via the input.source() function.
Default: close.
Dynamic Customization:
Color: Choose a color for each SMA line.
Visibility: Toggle SMA visibility.
Source: Change the source data used for SMA calculation.
Simplicity: Everything is configurable directly through the script settings.
How to Use:
Paste this script into the Pine Editor on TradingView.
Click Add to Chart.
Open the script settings (gear icon):
Set the desired lengths, colors, and visibility for SMA 20, 50, and 100.
Choose the source (e.g., close, open, high, etc.) for SMA calculations.
This version provides complete flexibility for SMA visualization and customization.
Simple Moving Average (SMA)simplemovingaverage100simplemovingaverage200simplemovingaverages

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