OPEN-SOURCE SCRIPT

%MA

70
This indicator is designed to plot a Simple Moving Average (SMA) along with customizable upper and lower bands (% up/down) on a TradingView chart. Here's a brief but thorough explanation of its functionality:

TL;DR: This script shows percentages above and below customizable moving average timeframes & legnths. It's unique in the sense that it isn't on a separate pane & gives visual clarity against the price in real time HLOC.

1. Main SMA Plot
The script calculates a Simple Moving Average (SMA) based on user-defined inputs:
Timeframe: E.g., daily ("Daily") by default.

Length: E.g., 50 periods by default.

Color: Customizable by the user.

This SMA acts as the central reference line and can be toggled on or off using a "Show" option.

2. Upper and Lower Bands
The script generates two upper bands and two lower bands around the main SMA.

Each band is derived from an SMA (calculated similarly to the main SMA) and offset by a percentage:
Upper Bands: SMA × (1 + distance percentage / 100), e.g., SMA × 1.05 for a 5% offset.

Lower Bands: SMA × (1 - distance percentage / 100), e.g., SMA × 0.95 for a 5% offset.

These bands can indicate potential support, resistance, or volatility ranges.

3. Customization
Users can independently configure:
Visibility: Toggle each band and the main SMA on or off.

Timeframe: Set the timeframe for each SMA calculation.

Length: Define the SMA period.

Distance Percentage: Adjust the offset for each band.

Color: Choose colors for all plotted lines.

This flexibility allows tailored analysis for different trading strategies or timeframes.

4. Plotting
The main SMA and each band are plotted using TradingView’s plot function, but only if their respective "Show" options are enabled.

Lines are displayed with user-specified colors and styles (e.g., the main SMA has a linewidth of 2).

Purpose
This script provides a versatile tool for technical analysis, enabling traders to visualize an SMA with percentage-based bands to identify key price levels or ranges, such as support/resistance, volatility zones, and trends, with extensive customization options.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.