Deviation Scaled Moving Average
Oct 6, 2018

The Deviation Scaled Moving Average indicator provides a volatility-adaptive smoothing mechanism designed to track price trends with minimal lag by dynamically adjusting its sensitivity based on price deviations.
Usage
The Deviation Scaled Moving Average (DSMA) is primarily used to identify trend direction and potential reversal points through the interaction of two separate DSMA lines with different lookback periods.
- Trend Identification: When the shorter-period DSMA (default 40) is above the longer-period DSMA (default 100), the trend is considered bullish. Conversely, when the shorter DSMA is below the longer one, the trend is considered bearish.
- Crossover Signals: Traders often look for crossovers between the two lines as entry or exit signals. A "Golden Cross" occurs when the fast DSMA crosses above the slow DSMA, suggesting a buying opportunity. A "Death Cross" occurs when the fast DSMA crosses below the slow DSMA, suggesting a selling opportunity.
- Volatility Adaptation: Because the script scales its alpha (smoothing factor) based on price deviation, the lines will track price more closely during high-volatility moves and flatten out during sideways consolidation.
Details
Developed by John Ehlers, the DSMA concept aims to solve the trade-off between lag and smoothness found in traditional moving averages. The implementation involves several technical stages:
- Preprocessing: The script calculates a "zeros" value (current price minus price two bars ago) to eliminate DC offsets.
- SuperSmoother Filter: This value is passed through a 2-pole SuperSmoother filter to remove high-frequency noise.
- RMS Scaling: The Root Mean Square (RMS) of the filtered signal is calculated over the user-defined period.
- Adaptive Alpha: The filtered signal is divided by its RMS to create a scaled filter. The absolute value of this scaled filter determines the alpha (weighting) used in the final exponential moving average calculation.
This architecture ensures that when price moves significantly (high deviation), the alpha increases to reduce lag. When price movement is negligible, the alpha decreases to increase smoothing.
Settings
- Period 1: Sets the lookback period for the first (typically faster) DSMA. This affects the smoothing and the RMS calculation for the first line.
- Period 2: Sets the lookback period for the second (typically slower) DSMA. This defines the baseline for the longer-term trend.
FAQ
What makes DSMA different from a standard EMA? While a standard Exponential Moving Average (EMA) uses a fixed multiplier, the DSMA uses an adaptive alpha that changes every bar based on the volatility of the filtered price, allowing it to react faster to sharp moves while remaining smooth during low volatility.
Can I change the colors of the DSMA lines? Yes, the colors and line styles can be adjusted within the Style tab of the indicator settings to suit different chart backgrounds or preferences.
How do I access the Deviation Scaled Moving Average? 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.