Skip to content
All library documents

Trend Detection with Exponential Moving Deviation Bands

Article TradingView scripts

Summary

This indicator defines trend direction with a moving average surrounded by bands based on exponentially smoothed absolute deviation. The average type, source price, lookback length, and deviation multiplier are configurable. A bullish state begins when the selected source crosses above the upper band; a bearish state begins when it falls below the lower band. The direction persists until the opposite threshold is crossed, while the average and bands are plotted for context.

The script offers overlay and backtest display modes, long, short, or combined signal settings, alerts, and comparisons with buy-and-hold equity. It also includes performance and trade metrics through an imported library. These features provide a framework for examining the rule, but the supplied document contains no actual performance results. Intrabar updates can cause signals to repaint, as the script itself notes; users can instead use prior-bar values. Backtest figures depend on the selected dates, sizing assumptions, market, and external library implementation.

Key ideas

  • The trend bands are formed by adding and subtracting a multiple of smoothed absolute deviation from a chosen moving average.
  • Crossing above the upper band switches the direction bullish, and crossing below the lower band switches it bearish.
  • Users can choose among several price sources, average types, lookback lengths, and deviation multipliers.
  • Intrabar updating may repaint signals, and the backtest mode reports configurable results rather than proving profitability.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.