Allows the user to adjust the ATR period and multiplier for the Supertrend calculation. Offers an option to choose between the standard ATR or a simple moving average (SMA) for ATR calculation. Source Price:
Users can select from four different EMAs (EMA1, EMA2, EMA3, EMA4) or use the default HL2 (average of high and low) as the source price for calculating the Supertrend. The EMAs are calculated with adjustable periods. Supertrend Calculation:
The Supertrend is calculated using the selected source price and ATR values. The trend direction is determined based on whether the closing price is above or below the Supertrend lines. Trend Plotting:
The script plots the Supertrend lines: green for an uptrend and red for a downtrend. These lines are updated based on trend reversals. Buy/Sell Signals:
The script generates buy and sell signals based on trend reversals (when the trend changes from up to down or vice versa). Buy and sell signals are marked on the chart using shapes and labels. Background Highlighting:
The background is highlighted in green for an uptrend and red for a downtrend. This can be turned on or off using the highlighting option. EMA Lines:
The selected EMAs (EMA1, EMA2, EMA3, EMA4) are plotted on the chart for reference. Alerts:
Alerts are triggered when a buy or sell signal occurs or when the trend direction changes. Customization: You can adjust the ATR period, multiplier, and EMA periods. You can enable or disable the display of buy/sell signals and background highlighting. The script allows for flexibility in choosing which EMA to use for the source price. This script provides a versatile Supertrend indicator with multiple EMA options and various customization choices for traders who want more control over their strategy.