OPEN-SOURCE SCRIPT

Robust Scaled Dema | Oquant

255
Overview
The Robust Scaled DEMA indicator is a tool designed for traders seeking to identify potential trend directions in financial markets. It combines the smoothing capabilities of a Double Exponential Moving Average (DEMA) with a robust scaling mechanism to normalize the data, making it more resilient to outliers and extreme price movements. This scaling helps in generating long and short signals based on predefined thresholds, visualized through color-coded plots and bars. The indicator aims to provide a balanced view of market momentum, reducing the impact of noise while highlighting significant shifts in price behavior.

Key Factors/Components
DEMA (Double Exponential Moving Average): Serves as the core smoothing component, reducing lag compared to simple averages by emphasizing recent price action more effectively.
Robust Scaling Mechanism: Utilizes statistical measures like median and interquartile range to normalize the DEMA values, ensuring the indicator is less sensitive to extreme values or price spikes.
Thresholds: User-defined upper and lower levels that trigger long or short signals when the scaled DEMA crosses them.
Visual Elements: Includes plotted lines for the scaled DEMA and thresholds, plus color-coded candlestick bars for intuitive interpretation.
Alerts: Built-in conditions for notifying users of potential entry points for long or short positions.

How It Works
The indicator starts by applying a DEMA to the chosen price source to create a smoothed representation of the market's direction. This smoothed value is then scaled using a robust statistical approach that accounts for the distribution of recent DEMA values, centering it around a median and adjusting for variability to minimize the influence of outliers. The resulting scaled metric is compared against user-set upper and lower thresholds: crossing above the upper suggests a bullish momentum (long signal), while dipping below the lower indicates bearish conditions (short signal). A state variable tracks these conditions to color the chart accordingly, helping traders visualize regime changes. Optional alerts fire on transitions.

For Who Is Best/Recommended Use Cases
This indicator is ideal for traders who employ trend-following or momentum-based strategies and need tools that perform well in non-normal market conditions, such as during high volatility or in assets prone to spikes. Use cases include identifying entry/exit points in trending environments, confirming breakouts, or integrating into multi-indicator systems for added confirmation. Quantitative traders or those backtesting strategies will appreciate its customizable parameters for optimization.

Settings and Default Settings
Source: The price data input for calculations, such as close, open, high, or low. Default: close.
DEMA Length: Controls the period for the DEMA smoothing; shorter values increase responsiveness but may add noise, longer ones provide more lag but smoother signals. Default: 25.
Robust Scaling Length: Defines the lookback period for the scaling statistics; affects how adaptive the normalization is to recent data distributions. Default: 40.
Upper Threshold: The level above which a long signal is triggered; higher values make signals rarer but potentially more reliable. Default: 0.5.
Lower Threshold: The level below which a short signal is triggered; lower values allow for more aggressive bearish detection. Default: 0.

Conclusion
The Robust Scaled DEMA offers an outlier-resistant alternative to traditional moving average indicators, empowering traders to navigate volatile markets. By blending exponential smoothing with statistical robustness, it provides actionable insights into trend shifts while minimizing false positives from extreme events..

⚠️ Disclaimer: This indicator is intended for educational and informational purposes only. Trading/investing involves risk, and past performance does not guarantee future results. Always test and evaluate indicators/strategies before applying them in live markets. Use at your own risk.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.