All indicators

Median Supertrend

Sep 4, 2024

Static chart image
SignalsChannelsVolatility

The Median Supertrend indicator is a trend-following tool that combines a median-based smoothing mechanism with a modified Supertrend calculation to provide more stable and accurate trend signals. By utilizing the 50th percentile of price data rather than raw closing prices, the script filters out short-term market noise and reduces the impact of price spikes on trend detection.

Usage

The Usage section describes how the script can be used to identify market direction and potential reversals. The indicator plots a smoothed median line and dynamic trend bands on the chart. When the price is trending upward, the area between the median and the lower band is filled with a bullish color (typically green). Conversely, when the price is trending downward, the area between the median and the upper band is filled with a bearish color (typically red).

Traders can use the Median Supertrend for:

  • Trend Following: Aligning trades with the color-coded zones to ensure they are trading in the direction of market momentum.
  • Reversal Detection: Identifying potential trend changes when the price crosses the trend bands, causing the indicator to flip its orientation.
  • Volatility Filtering: Using the median-based smoothing to avoid being "whipsawed" by temporary price fluctuations during consolidation phases.

Details

The Median Supertrend enhances the standard Supertrend formula through several technical innovations:

  • Median Smoothing: Instead of using the raw price, the script calculates the 50th percentile (median) of the source over a user-defined length. This provides a "center of gravity" that is less sensitive to outliers than a standard moving average.
  • ATR-Based Bands: The tool applies an Average True Range (ATR) multiplier to the smoothed median to determine the distance of the trend bands.
  • Persistence Logic: The calculation includes logic to prevent trend bands from shifting back and forth excessively during flat markets. Once a trend is established, the bands adjust smoothly, requiring a definitive price cross to signal a reversal.

Settings

The settings are divided into two main categories to allow for fine-tuned control over responsiveness:

Median Supertrend

  • Supertrend len: The period used for the ATR calculation, which determines the volatility component of the bands.
  • Multiplier: A factor applied to the ATR. Higher values result in bands being further from the price, leading to fewer but more significant trend signals.

Median smoothing

  • Median len: The lookback period used to calculate the 50th percentile (median) of the price.
  • Median smoothing source: The price data point (e.g., Close, HL2) used as the input for the median calculation.

FAQ

How do I use the Median Supertrend?

You can use it to identify the prevailing market trend by looking at the colored zones and the position of the trend bands relative to the smoothed median line.

What makes this different from a regular Supertrend?

Unlike a standard Supertrend that uses the raw price, this version uses a median-smoothed price, which results in more stable signals and better noise reduction in volatile markets.

How can I access this script?

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.