OPEN-SOURCE SCRIPT

MAD Trend Detector ~ C H I P A

873
MAD Trend Detector ~ C H I P A is a custom trend detection tool designed to identify meaningful price deviations using Median Absolute Deviation (MAD) logic layered over a smoothed price baseline.

It uses:

A user-selectable source (Close, High, Low, etc.)

A configurable EMA or SMA as the core smoothing layer

Median Absolute Deviation (MAD) to measure typical price dispersion

A user-adjustable MAD multiplier to fine-tune trend sensitivity

Trend bands that expand dynamically based on local volatility

This setup highlights breakout conditions when price detaches meaningfully from its typical behavior — helping traders detect trend acceleration, volatility breakouts, and directional shifts with minimal lag and reduced noise.

Candle coloring responds directly to trend status, with electric blue and red visuals for clear on-chart recognition.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.