Skip to content
All library documents

Lorentzian Distance K-Nearest Neighbors for Market Signals

Article TradingView scripts

Summary

This indicator applies a nearest-neighbor classification approach to market features, using a Lorentzian-style distance measure. Rather than summing raw feature differences as in Euclidean distance, its distance function sums logarithms of one plus the absolute difference for each feature. The accompanying explanation argues that this can reduce the influence of large outliers and noise when comparing historical observations, especially around major market events. Candidate inputs include normalized RSI, WaveTrend, CCI, and ADX features, with configurable feature count and neighbor count.

The indicator also includes filters for volatility, market regime, and ADX, along with kernel-based logic for optional dynamic exits and display tools for signals and trade statistics. Those statistics are described as calibration aids rather than a substitute for proper backtesting; options also address close-only estimates and intrabar repainting concerns. The document presents a design rationale and implementation, but no independent performance study validating the distance metric or signal quality. Results may depend on feature selection, settings, market regime, and execution assumptions.

Key ideas

  • The classifier compares current feature values with historical examples using a sum of log-transformed absolute differences.
  • The document motivates Lorentzian distance as a way to reduce the influence of outliers and event-driven distortions.
  • RSI, WaveTrend, CCI, and ADX are available as candidate features, with configurable feature and neighbor counts.
  • Volatility, regime, and ADX filters can screen model signals, while kernel logic supports optional dynamic exits.
  • Displayed trade statistics are intended for calibration, and the document supplies no independent evidence of predictive performance.

Tags

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