All indicators

SuperTrend

Mar 13, 2020

Static chart image
Dynamic OverlaysSignalsTrailing-StopVolatility

The SuperTrend indicator provides a versatile trend-following volatility band used to identify market direction and potential reversal points through ATR-based trailing stops.

Usage

The Usage section describes how the script can be used in various market conditions. The indicator plots a dynamic line that follows price action; when the price is above the line, the trend is considered bullish (green), and when the price is below the line, the trend is considered bearish (red).

Traders use the SuperTrend for:

  • Trend Identification: Determining the current market bias across equities, forex, crypto, and futures.
  • Entry Signals: A "Buy" signal is generated when the trend flips from bearish to bullish (price closes above the upper band). A "Sell" signal is generated when the trend flips from bullish to bearish (price closes below the lower band).
  • Trailing Stop Loss: Using the plotted line as a dynamic level to protect profits during an ongoing trend.

While highly effective in trending markets, users should note that the indicator may produce false signals during sideways or range-bound market conditions.

Details

The SuperTrend calculation is rooted in the Average True Range (ATR), which measures market volatility. The indicator creates bands by adding or subtracting a multiple of the ATR from the median price (HL2).

The script includes a unique logic to prevent the trailing stop from moving against the trend:

  • Upward Trend: The floor (Up Trend line) can only move higher or stay flat; it cannot decrease.
  • Downward Trend: The ceiling (Down Trend line) can only move lower or stay flat; it cannot increase.

This version provides flexibility in ATR calculation, allowing users to choose between the standard RMA (Running Moving Average) and SMA (Simple Moving Average) methods, which affects how reactive the indicator is to recent price spikes. This implementation is inspired by technical standards developed for platforms like MetaStock and modernized for Pine Script with visual highlights and optimized alerts.

Settings

  • ATR Period: Sets the lookback period for the Average True Range calculation (Default: 10).
  • Source: Determines the price source used for the calculation (Default: HL2).
  • ATR Multiplier: The coefficient used to multiply the ATR value to set the distance of the bands from the price (Default: 3.0).
  • Change ATR Calculation Method?: When enabled, the indicator uses the standard RMA-based ATR. When disabled, it switches to an SMA-based ATR calculation.
  • Show Buy/Sell Signals?: Toggles the visibility of "Buy" and "Sell" labels on the chart.
  • Highlighter On/Off?: Toggles the background shading between the price and the SuperTrend line.

FAQ

How do I interpret the Buy and Sell signals? A Buy signal appears when the price closes above the red line, turning it green. A Sell signal appears when the price closes below the green line, turning it red.

Which markets and timeframes work best with SuperTrend? The indicator is functional on all timeframes (intraday, daily, weekly) and asset classes, though it performs most reliably on trending higher timeframes like the 1H, 4H, or Daily charts.

How can I access this indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.