The SuperTrend indicator is a popular trend-following tool that combines price action with volatility. It plots a line above or below the price to indicate the current trend direction and potential stop-loss levels. When the price is above the SuperTrend line, the trend is bullish (green). When the price is below the line, the trend is bearish (red).
Created by Olivier Seban, the SuperTrend indicator was designed to be a simple, visual system for identifying trends and managing trailing stops. It gained massive popularity in retail trading communities due to its clear "buy/sell" visual nature and its ability to filter out minor fluctuations while keeping traders in major moves.
SuperTrend uses the Average True Range (ATR) to measure market volatility. It then calculates a "Basic Upper Band" and "Basic Lower Band" based on the average price (HL2) plus/minus a multiple of the ATR.
- $Upper_{final}$: If current $Upper_{basic} < prev Upper_{final}$ or $prev Close > prev Upper_{final}$, then $Upper_{basic}$, else $prev Upper_{final}$.
- $Lower_{final}$: If current $Lower_{basic} > prev Lower_{final}$ or $prev Close < prev Lower_{final}$, then $Lower_{basic}$, else $prev Lower_{final}$.
4.**SuperTrend Logic:**
- If Trend is Bullish: $SuperTrend = Lower_{final}$
- If Trend is Bearish: $SuperTrend = Upper_{final}$
- **Buy Signal:** Price closes above the SuperTrend line (Trend flips from Bearish to Bullish).
- **Sell Signal:** Price closes below the SuperTrend line (Trend flips from Bullish to Bearish).
#### Trailing Stop
- The SuperTrend line itself serves as an excellent trailing stop-loss level. In an uptrend, place stops just below the green line. In a downtrend, place stops just above the red line.
### When It Works Best
- **Trending Markets:** SuperTrend excels at capturing large moves and keeping you in the trade until the trend actually reverses.
### When It Struggles
- **Sideways Markets:** In choppy, range-bound markets, price will frequently cross the line, causing "whipsaws" (rapid buy/sell signals that result in losses).
## Architecture Notes
This implementation makes specific trade-offs:
### Choice: ATR Smoothing
- **Implementation:** Uses RMA (Wilder's Smoothing) for ATR calculation.
- **Rationale:** Standard definition of ATR uses RMA. Using SMA or EMA would deviate from the standard SuperTrend formula found on most platforms.