Deviation Trend Profile [BigBeluga]

Published on MillionChart by PipMaster.

Deviation Trend Profile is an experimental, educational tool that combines a moving average with deviation zones and a distribution profile for the active trend.

How it works:
- Trend detection: a trend shift is flagged when the slope of the SMA passes a threshold of plus or minus 0.1.
- Deviation zones: levels at plus and minus 1, 2 and 3 are drawn around the SMA, using ATR to size them.
- Distribution profile: a histogram shows how often price closed inside each zone during the current trend phase.

Features:
- Coloured circles mark trend reversals.
- The SMA changes colour according to its slope.
- A label above the histogram shows how many bars the current trend has lasted.
- The number of histogram bins can be adjusted.
- Zone lines and labels use a consistent colour scheme.

Reading the profile:
- A wide profile skewed toward the plus/minus 2 and 3 zones points to a strong directional trend.
- A profile bunched near the SMA suggests the trend may be tiring or the market is ranging.

How to use:
- Treat the dots as trend-start markers: blue for bullish, red for bearish.
- Favour trading with the trend when price clusters in the outer zones.
- Be careful, or consider fading, when the distribution contracts toward the SMA.
- Check several timeframes for agreement or disagreement.