Adaptive Supertrend with Dynamic Optimization
Dec 5, 2024

The Adaptive Supertrend with Dynamic Optimization tool provides a sophisticated evolution of the traditional Supertrend indicator by incorporating real-time mathematical optimization and multi-factor signal filtering. It aims to reduce noise and adapt to changing market volatility to provide more reliable trend identification and entry signals.
Usage
The indicator can be used to identify trend direction and potential entry points through its color-coded trend line and "BUY/SELL" labels. When the price crosses above the optimized supertrend line, a bullish trend is identified; conversely, a cross below indicates a bearish trend.
Key usage features include:
- Dynamic Bands: The indicator automatically adjusts its width based on market volatility, expanding during high-volatility periods to avoid whipsaws and tightening during stable regimes to capture smaller moves.
- RSI & MACD Filtering: The script uses RSI to adjust band sensitivity (widening by 20% in extreme trends and tightening by 20% near potential reversals) and MACD crossovers to confirm trend changes.
- Signal Cooldown: To prevent signal clustering in choppy markets, the tool enforces a cooldown period, ensuring that labels are not generated too frequently in a short period.
- Trend Confirmation: The script includes internal EMA checks (20/50) to ensure signals align with the broader market direction.
Details
This implementation moves beyond static multipliers by using a performance-based optimization algorithm. It evaluates a range of potential multipliers using a Sharpe ratio-inspired scoring system, which penalizes drawdowns and rewards risk-adjusted returns over a specific lookback period. The resulting "Optimized Multiplier" is then applied to the ATR-based bands. Furthermore, the indicator utilizes double smoothing (SMA and EMA) on the supertrend line to ensure visual clarity and reduce erratic movements caused by price spikes.
Settings
Core Settings
- ATR Period: Sets the lookback period for the Average True Range calculation (default is 10).
- Initial Multiplier: The starting multiplier for the bands before optimization takes effect.
- Optimization Lookback: The number of bars used to evaluate the performance of different multiplier settings.
- Adaptive Rate: Controls how quickly the optimized multiplier reacts to recent price changes.
Filters & Smoothing
- Profit Target / Max Loss Multiples: Parameters used within the internal performance evaluator to score different multiplier settings.
- Smoothing Period: Adjusts the smoothness of the ATR and the final supertrend line (default is 3).
- Signal Cooldown Period: The minimum number of bars required between consecutive signals.
- Confirmation Bars: The number of bars a condition must be met before a signal is confirmed.
FAQ
How do I use the Adaptive Supertrend with Dynamic Optimization?
You can use it as a primary trend filter. Look for "BUY" labels when the price is in an uptrend and "SELL" labels during downtrends, ideally when confirmed by the color change of the trend line.
What makes this different from a standard Supertrend?
Unlike the standard version which uses a fixed multiplier, this version dynamically optimizes the multiplier based on historical performance and adjusts band width using RSI and volatility metrics.
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.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.