Skip to content
All library documents

Volume SuperTrend with Weighted K-Nearest-Neighbor Signals

Article ProRealCode

Summary

The indicator combines a SuperTrend-style trailing line with a volume-weighted moving average and a k-nearest-neighbors classifier. The trend bands are centered on the volume-weighted average and offset using average true range. For its classifier, the described implementation compares recent SuperTrend values with stored values, sorts their distances, and uses inverse-distance weighted labels from the nearest observations to assign a bullish or bearish state. Line colors and optional markers communicate those states and trend changes.

Settings include the neighbor count, data window, weighted-average lengths, SuperTrend length and multiplier, and whether to show AI signals. The document presents the line as a possible dynamic trailing stop and describes colored trend readings as directional signals. It does not provide validation data, a backtest, or evidence that the classifier predicts future moves accurately. The code description also leaves practical questions about data handling and implementation behavior, so users would need to verify the calculations and test the method before relying on it.

Key ideas

  • The SuperTrend bands use a volume-weighted average as their center and average true range for their offset.
  • A k-nearest-neighbors procedure classifies recent SuperTrend observations using distance-weighted labels.
  • Bullish and bearish labels control the plotted line color and optional trend markers.
  • The settings affect the classifier window, neighbor count, smoothing lengths, and SuperTrend calculation.
  • No backtest or predictive-performance evidence is provided.

Tags

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