Skip to content
All library documents

KNN Classification of RSI States with Adaptive Supertrend Signals

Article ProRealCode

Summary

This indicator converts RSI behavior into eight normalized features, including level, slope, acceleration, percentile, volatility, fast-versus-slow spread, and regime. It stores sampled feature vectors alongside forward price outcomes grouped into ATR-scaled classes, then compares the current vector with historical examples using a log-compressed distance and a nearest-neighbor vote. The vote estimates directional bias and match quality.

Signals require a bias change plus rank and confidence thresholds, trend and volatility checks, chop filters, and a cooldown. The companion Supertrend adjusts its ATR bands according to conviction, while the oscillator and its signal line provide additional momentum context. The document supplies implementation details and default settings, but no backtest or performance evidence. Results will depend on the asset, timeframe, feature normalization, training history, and chosen gates; the described historical analogues do not establish predictive edge or account for trading costs.

Key ideas

  • RSI readings are represented as normalized multidimensional momentum fingerprints rather than interpreted only through fixed thresholds.
  • Historical fingerprints are paired with subsequent ATR-scaled price outcomes to form a continuously updated labeled memory bank.
  • A distance-weighted nearest-neighbor vote estimates direction, agreement, and the closeness of historical matches.
  • Rank, confidence, trend, volatility, chop, and cooldown conditions filter bias changes before signals appear.
  • The Supertrend varies its ATR band width with model conviction, changing how quickly its trailing level follows price.

Tags

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