Supertrend indicator used in mt5 only
- Indicatori
- George Njau Ngugi
- Versione: 1.0
- Attivazioni: 5
- Purpose: The SuperTrend indicator tracks price trends, plotting a line that follows the trend direction (up or down) and optionally fills the area between the trend line and the closing price
- Plots:
- SuperTrend Line: A colored line (green for uptrend, red for downtrend) plotted below the price in uptrends and above in downtrends.
- Filling: Optional filled area (bisque/pale green) between the SuperTrend line and the closing price, shown only if Show_Filling is true.
- Logic:
- Calculates ATR using the iATR function to measure volatility.
- Computes a middle line ((high + low) / 2), upper band (Middle + Multiplier * ATR), and lower band (Middle - Multiplier * ATR).
- Determines trend direction:
- Uptrend (trend = 1): When the closing price exceeds the previous upper band.
- Downtrend (trend = -1): When the closing price falls below the previous lower band.
- Maintains trend continuity if no crossover occurs.
- Adjusts bands to prevent unnecessary fluctuations (e.g., lower band doesn’t decrease in an uptrend).
- Sets the SuperTrend line to the lower band (uptrend) or upper band (downtrend), with color changes based on trend direction.
- Buffers: Uses 9 buffers:
- Filled_a, Filled_b: For the optional filling area.
- SuperTrend, ColorBuffer: For the trend line and its color.
- Atr, Up, Down, Middle, trend: For internal calculations.
Functionality
- Trend Identification: Signals bullish (up) or bearish (down) trends based on price position relative to bands.
- Visualization: Provides a clear visual with a dynamic trend line and optional price-trend filling for better trend tracking.
- Use Case: Suitable for trend-following strategies, especially in trending markets, but may lag or give false signals in choppy conditions.
