OPEN-SOURCE SCRIPT

Adaptive Supertrend with Dynamic Optimization [EdgeTerminal]

The Enhanced Adaptive Supertrend represents a significant evolution of the traditional Supertrend indicator, incorporating advanced mathematical optimization, dynamic volatility adjustment, intelligent signal filtering, reduced noise and false positives.

Key Features

  • Dynamic volatility-adjusted bands
  • Self-optimizing multiplier
  • Intelligent signal filtering system
  • Cooldown period to prevent signal clustering
  • Clear buy/sell signals with optimal positioning
  • Smooth trend visualization
  • RSI and MACD integration for confirmation
  • Performance-based optimization


Dynamic Band Calculation

Dynamic Band Calculation automatically adapts to market volatility, generates wider bands in volatile periods, reducing false signals. It also generates tighter bands in stable periods, capturing smaller moves and smooth transitions between different volatility regimes.

RSI Integration

The RSI and MACD play multiple crucial roles in the Adaptive Supertrend.

It first helps with momentum factor calculation. This dynamically adjusts band width based on momentum conditions. When the RSI is oversold, bands widen by 20% to prevent false signals during strong downtrends and provide more room for price movements in extreme conditions.
When the RSI is overbought, brands tighten by 20% and they become more sensitive to potential reversals to help catch trend changes earlier.

This reduces false signals in strong trends, helps detect potential reversals earlier than the usual, create adaptive band width based on market conditions and finally, better protection against whipsaws.

MACD Integration

The MACD in this supertrend indicator serves as a trend confirmation tool. The idea is to use MACD crossovers to confirm trend changes to reduce false trend change signals and enhance the signal quality.

For this to become a signal, MACD crossovers must align with price movement to help filter out weak or false signals, which acts as an additional layer of trend confirmation.

Additionally, MACD line position relative to signal line indicates trend strength, helps maintain positions in strong trends and assists in early detection of trend weakening.

Momentum Integration

Momentum Integration prevents false signals in extreme conditions, It adjusts dynamic bands based on market momentum, improves trend confirmation in strong moves and reduces whipsaws during consolidations.

Improved signals

There are a few systems to generate better signals, allowing for generally faster signals compared to original supertrend, such as:

  • Enforced cooldown period between signals
  • Prevents signal clustering
  • Clearer entry/exit points
  • Reduced false signals during choppy markets


Performance Optimization

This script implements a Sharpe ratio-inspired optimization algorithm to balance returns against risk, penalize large drawdowns, adapt parameters in real-time and improve risk-adjusted performance

Parameter Settings

ATR Period: 10 (default) - adjust based on timeframe
Initial Multiplier: 3.0 (default) - will self-optimize
Optimization Period: 50 (default) - longer periods for more stability
Smoothing Period: 3 (default) - adjust for signal smoothness

Best Practices

  1. Use on multiple timeframes for confirmation
  2. Allow the optimization process to run for at least 50 bars
  3. Monitor the adaptive multiplier for trend strength indication
  4. Consider RSI and MACD alignment for stronger signals

adaptiveATRAverage True Range (ATR)dynamicsupertrendTrend Analysis

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal