A k-Nearest Neighbors Indicator for Directional Market Signals
Summary
This indicator uses two selected features, drawn from RSI, CCI, rate of change, and normalized volume, to compare current market conditions with stored historical observations. Each observation is paired with a label representing a subsequent price direction. The script computes Euclidean distances and aggregates labels from a set of candidate neighbors to produce a directional score; positive and negative scores generate long and short signals. An optional filter compares short and longer ATR values, and a bar threshold limits signal duration. The score's magnitude is suggested as a possible input to position sizing.
The script is a framework for exploring whether indicator combinations contain predictive information, not evidence that they do. Its author explicitly warns that signals repaint, and the code notes a limitation in its neighbor-selection approach: a large distance can affect which observations enter the prediction set. The included backtesting section is unfinished, so the document does not establish returns, robustness, or suitability across the asset classes it mentions.
Key ideas
- The model represents market conditions with two features selected from several technical indicators and volume.
- Historical feature pairs are associated with labels for subsequent directional movement.
- Distances between the current feature pair and stored observations inform an aggregate directional prediction.
- An optional ATR comparison filters signals, while a bar threshold limits their duration.
- The signals repaint, and the script includes no completed performance evaluation.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.