OPEN-SOURCE SCRIPT

DEB SuperTrend [Mattes]

Updated
The Dynamic Envelope Based Supertrend integrates two key concepts: dynamic envelopes and the Supertrend, creating a powerful trend-following tool. Understanding its functionality requires a closer look at how the envelopes are constructed and how they interact with price action.


  1. Dynamic Envelopes
    >>> Dynamic envelopes are bands that surround a central moving average (MA) which is set by the user. These are then calculated based on the standard deviation of price movements over a specified period. The formula for the upper and lower envelopes is as follows:
    Upper Envelope=MA+(Multiplier×STD)
    Lower Envelope=MA−(Multiplier×STD)

    This dynamic approach ensures that the envelopes expand and contract based on market volatility. In periods of high volatility, the envelopes widen, allowing for more price movement without triggering false signals. Conversely, in low-volatility periods, the envelopes tighten, enhancing sensitivity to price changes.

  2. Interaction with the Supertrend
    The Supertrend component is a trend-following indicator that utilizes the concept of Average True Range (ATR) to define its trailing stop levels.
    In this indicator however (like I've mentioned before), the ATR bands have been replaced with the STD envelopes, as they offer a better performance compared to ATR bands.

  3. Trend Direction
    The Supertrend indicator generates buy and sell signals based on price crossing the calculated upper and lower envelopes:
    >>> Buy Signal: Triggered when the price closes above the upper envelope, indicating a potential upward trend.
    >>> Sell Signal: Triggered when the price closes below the lower envelope, suggesting a downward trend.
  4. Adaptive Nature:
    The dynamic envelopes effectively serve as dynamic support and resistance levels, which adapt to price movements and volatility, while the Supertrend tracks these levels to confirm the trend direction and adjust accordingly to changes, making it an enhanced version of ATR Based Supertrends.



  • Unique Aspects and Advantages
    ->>>> The Dynamic Envelope Based Supertrend is unique for several reasons:
    >>> Volatility Responsiveness: The indicator adjusts its sensitivity based on market conditions, reducing the likelihood of false signals during quiet market phases and improving reliability during volatile periods. This is reasoned by the STD envelope bands contracting and expanding relative to the tickers performance.
    >>> Trend Confirmation: By integrating the Supertrend logic, the indicator not only provides entry signals but also guides traders on when to exit, maintaining a focus on trend-following rather than mean reversion.
    >>> Stability: Due to its use of Standard deviation envelopes, it is very ressistant in periods of uncertainty, Rather than buy bottom and selling tops, it stays long/short for the complete period of mean reverting environments, which is based on the bigger and fuller trend direction on the larger timescales.
    >>> Clear Signals: The indicator simplifies decision-making by offering visual cues through its envelopes and trend signals, making it accessible to traders of all experience levels.


Summary:
The Dynamic Envelope Based Supertrend is a sophisticated trend-following indicator that intelligently combines dynamically adjusted STD envelopes with Supertrend logic. By incorporating volatility metrics, it offers a clear and actionable framework for traders, enhancing their ability to identify and follow trends effectively.
Release Notes
The Dynamic Envelope Based Supertrend integrates two key concepts: dynamic envelopes and the Supertrend, creating a powerful trend-following tool. Understanding its functionality requires a closer look at how the envelopes are constructed and how they interact with price action.


  1. Dynamic Envelopes
    >>> Dynamic envelopes are bands that surround a central moving average (MA) which is set by the user. These are then calculated based on the standard deviation of price movements over a specified period. The formula for the upper and lower envelopes is as follows:
    Upper Envelope=MA+(Multiplier×STD)
    Lower Envelope=MA−(Multiplier×STD)

    This dynamic approach ensures that the envelopes expand and contract based on market volatility. In periods of high volatility, the envelopes widen, allowing for more price movement without triggering false signals. Conversely, in low-volatility periods, the envelopes tighten, enhancing sensitivity to price changes.

  2. Interaction with the Supertrend
    The Supertrend component is a trend-following indicator that utilizes the concept of Average True Range (ATR) to define its trailing stop levels.
    In this indicator however (like I've mentioned before), the ATR bands have been replaced with the STD envelopes, as they offer a better performance compared to ATR bands.

  3. Trend Direction
    The Supertrend indicator generates buy and sell signals based on price crossing the calculated upper and lower envelopes:
    >>> Buy Signal: Triggered when the price closes above the upper envelope, indicating a potential upward trend.
    >>> Sell Signal: Triggered when the price closes below the lower envelope, suggesting a downward trend.
  4. Adaptive Nature:
    The dynamic envelopes effectively serve as dynamic support and resistance levels, which adapt to price movements and volatility, while the Supertrend tracks these levels to confirm the trend direction and adjust accordingly to changes, making it an enhanced version of ATR Based Supertrends.



  • Unique Aspects and Advantages
    ->>>> The Dynamic Envelope Based Supertrend is unique for several reasons:
    >>> Volatility Responsiveness: The indicator adjusts its sensitivity based on market conditions, reducing the likelihood of false signals during quiet market phases and improving reliability during volatile periods. This is reasoned by the STD envelope bands contracting and expanding relative to the tickers performance.
    >>> Trend Confirmation: By integrating the Supertrend logic, the indicator not only provides entry signals but also guides traders on when to exit, maintaining a focus on trend-following rather than mean reversion.
    >>> Stability: Due to its use of Standard deviation envelopes, it is very ressistant in periods of uncertainty, Rather than buy bottom and selling tops, it stays long/short for the complete period of mean reverting environments, which is based on the bigger and fuller trend direction on the larger timescales.
    >>> Clear Signals: The indicator simplifies decision-making by offering visual cues through its envelopes and trend signals, making it accessible to traders of all experience levels.


Whats is different from the previous version?
I have deleted unecessary lines of code, as I previously wanted to use gaussian smoothing, but I later changed my mind.


Summary:
The Dynamic Envelope Based Supertrend is a sophisticated trend-following indicator that intelligently combines dynamically adjusted STD envelopes with Supertrend logic. By incorporating volatility metrics, it offers a clear and actionable framework for traders, enhancing their ability to identify and follow trends effectively.
Moving AveragesTrend AnalysisVolatility

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer