Skip to content
All library documents

Clustering Closing Prices to Estimate Support and Resistance

Article TradingView scripts

Summary

This indicator applies one-dimensional clustering to recent closing prices to identify price levels where observations concentrate. Users choose a cluster count, a training window, and either a mean-based or median-based center. Each close in the window is assigned to its nearest center, and the centers are iteratively recalculated until their changes fall below a threshold. The resulting centers are drawn as horizontal levels; optional bands show dispersion around each center, and a table reports each cluster’s share of assigned observations.

The display offers a data-driven way to summarize historical price distributions as candidate support or resistance zones. The document does not report trading results, predictive accuracy, or a procedure for converting the levels into entries and exits. Since the clustering is recalculated from a selected historical window, its levels depend on the chosen window, cluster count, and center method, and may shift as the data change. The levels describe past price concentration; the document does not establish that they will act as future barriers.

Key ideas

  • The indicator clusters recent closing prices by assigning each observation to its nearest price center.
  • Cluster centers can use either the mean or median, and the number of clusters and training window are configurable.
  • Optional dispersion bands and cluster-density percentages summarize the spread and frequency of observations around each level.
  • The document provides no evidence that the historical clusters predict future support or resistance behavior.

Tags

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