Skip to content
All library documents

Adaptive SuperTrend Using K-Means ATR Volatility Clusters

Article TradingView scripts

Summary

This indicator adapts a SuperTrend line to current volatility by clustering recent Average True Range values into high, medium, and low groups. It initializes three centroids from selected points within the ATR range, repeatedly assigns observations to their nearest centroid, and updates each centroid from its cluster average. The centroid nearest to current ATR becomes the volatility input for the SuperTrend calculation.

The chart marks trend direction changes and displays cluster levels, centroids, and membership counts, with alerts for trend shifts and changes in volatility class. The source gives implementation details and configurable ATR, lookback, and trend-factor settings, but no trading results or validation against a baseline. Clustering quality depends on the lookback and initialization, and the indicator alone does not specify entries, exits, position sizing, or risk controls.

Key ideas

  • Recent ATR observations are grouped into three volatility regimes using iterative centroid updates.
  • The cluster closest to current ATR supplies the adaptive volatility value for the SuperTrend bands.
  • Trend shifts and changes between volatility clusters can be displayed and signaled with alerts.
  • Settings control ATR length, training window, initial centroid guesses, and SuperTrend factor.
  • The document provides no evidence that the indicator improves trading performance.

Tags

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