OPEN-SOURCE SCRIPT

SuperTrend Dual RMA

193
Overview
The SuperTrend Dual RMA is a hybrid volatility-based trend-following system that merges two Relative Moving Averages (RMAs) with an Average True Range (ATR)–anchored SuperTrend framework. The primary purpose of this indicator is to offer a smoother and more reliable depiction of directional bias while maintaining sensitivity to price volatility and market volume.
Traditional SuperTrend implementations typically rely on a single moving average and a fixed volatility envelope. This dual RMA structure introduces an adaptive central tendency line that reacts proportionally to both price and volume, allowing for more nuanced identification of trend reversals and continuation patterns.

**Core Concept**
The indicator is built around two key principles — smoothing and volatility adaptation.

1. **Smoothing:** The use of two separate RMAs with configurable lengths creates a dynamic equilibrium between short-term responsiveness and long-term stability. The first RMA captures near-term directional shifts, while the second provides broader market context. The average of both becomes the foundation of the SuperTrend bands.
2. **Volatility Adaptation:** The ATR multiplier and period define the distance between upper and lower bands relative to recent volatility. This ensures that the SuperTrend line remains flexible across varying market conditions — expanding during high volatility and contracting during calm phases.

**Calculation Steps**

* The indicator first computes two volume-weighted RMAs based on the typical price (`hlc3`) multiplied by trading volume.
* Each RMA is normalized by the smoothed volume to maintain proportional weighting.
* These two RMAs are averaged to produce a “basis line” that reflects the current market consensus price.
* The ATR is calculated over a user-defined period, then multiplied by a volatility factor (ATR multiplier).
* The resulting ATR value defines dynamic upper and lower thresholds around the basis line.
* Trend direction is determined by price closing behavior relative to these thresholds:

* When the closing price exceeds the upper band, the trend is considered bullish.
* When it drops below the lower band, the trend turns bearish.
* If price remains within the bands, the prior trend direction is maintained for consistency.

**Visual Structure**
The SuperTrend Dual RMA provides multiple layers of visual feedback for enhanced interpretation:

* Two distinct RMA lines (short and long) are plotted with complementary colors for contrast and clarity.
* A soft fill between the RMA lines highlights the interaction between short- and medium-term momentum.
* The ATR-based SuperTrend bands are drawn above and below the basis, with adaptive coloring that corresponds to the prevailing trend direction.
* Bar colors automatically adjust to reflect bullish or bearish bias, making it easy to identify trend shifts without relying solely on crossovers.
* Optional triangle markers appear below or above bars to signal potential buy or sell opportunities based on crossover logic.

**Signals and Alerts**
The indicator provides real-time crossover detection:

* **Buy Signal:** Triggered when the closing price moves above the SuperTrend line, confirming potential bullish continuation or reversal.
* **Sell Signal:** Triggered when the closing price drops below the SuperTrend line, indicating possible bearish momentum or reversal.
Both conditions have built-in `alertcondition()` functions, allowing users to set automated alerts for trading or monitoring purposes. This enables integration with TradingView’s alert system for push notifications, emails, or webhook connections.

**Usage Guidelines**

* **Trend Identification:** Use the color-coded trend line and bar color as a visual guide to the current directional bias.
* **Entry and Exit Timing:** Consider entering trades when a new crossover alert appears, preferably in the direction of the overall higher-timeframe trend.
* **Parameter Tuning:** Adjust the RMA lengths and ATR parameters based on asset volatility. Shorter RMA and ATR settings provide faster reactions, suitable for intraday or high-frequency trading, while longer configurations better fit swing or position strategies.
* **Risk Management:** Because the SuperTrend inherently acts as a dynamic stop level, traders can use the opposite band or SuperTrend line as a trailing stop or exit signal.

**Practical Applications**

* Trend confirmation in multi-timeframe strategies.
* Adaptive trailing stop placement using the lower or upper band.
* Visual comparison of volume-weighted price movement against volatility envelopes.
* Integration into algorithmic trading systems as a signal filter or trend bias component.
* Identification of overextended conditions when price significantly diverges from the SuperTrend basis.

**Originality and Advantages**
The SuperTrend Dual RMA differentiates itself from conventional SuperTrend scripts through three innovative design choices:

1. **Dual Volume-Weighted RMAs:** By incorporating two RMAs weighted by trading volume, the indicator accounts for liquidity dynamics, producing smoother and more reliable averages compared to price-only calculations.
2. **Anchored SuperTrend Framework:** The SuperTrend bands are not derived from a fixed source (such as a single close or median price) but from a blended RMA basis, making them more adaptable to varying market behaviors.
3. **Integrated Multi-Layer Visualization:** The inclusion of filled regions between RMAs, dynamic band coloring, and bar tinting enhances readability and analytical depth without overwhelming the chart.

These improvements collectively create a more balanced and data-rich representation of market structure, offering a higher degree of analytical precision. It’s suitable for traders seeking both discretionary and systematic use, as the indicator’s logic is transparent and compatible with alert-based or automated workflows.

**Summary**
The SuperTrend Dual RMA is a refined evolution of the classic SuperTrend, optimized for traders who value smoother directional tracking and more intelligent volatility adaptation. It blends two time-sensitive, volume-aware moving averages with an ATR-derived volatility system to deliver reliable, actionable trend information. Its visual design, adaptive responsiveness, and integrated alert functionality make it a complete solution for identifying and managing trends across multiple asset classes and timeframes.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.