Skip to main content
Strategy Learning Hub

Strategy #0000000024 · Statistical learning and prediction

Single-stock k-nearest-neighbour signal
Change neighbour returns and threshold to inspect an illustrative mean signal after costs.

Single-stock k-nearest-neighbour signal converts defined inputs into a rule or allocation. Its scenario illustrates the arithmetic, not validated excess returns.

Beginner-friendlyAbout 8 minutesEvidence and practical analysis

Three ways in

Understand the story. Then inspect the risk.

Start with a familiar situation, check the payoff, then test how the numbers change.

The idea · in two minutes

Single-stock k-nearest-neighbour signal

Rose standardises completed-session returns, volatility and volume using only the training window. She finds the k historical states nearest to today’s feature vector and examines their subsequent returns.

Jack notices that future fields, full-sample scaling or data known only after the close can make neighbours look implausibly accurate. They fix the rolling window, distance metric, k, threshold and next tradable price.

Neighbour averages are sensitive to k, scaling, regimes and outliers. The model needs simple baselines, costs and strictly time-ordered out-of-sample testing.

  • Neighbour 1Neighbour 1: assumed scenario 1.2; no historical observation is implied.
  • Neighbour meanNeighbour mean: assumed scenario 0.47; no historical observation is implied.
  • Illustrative net after threshold/costIllustrative net after threshold/cost: assumed scenario 0.37; no historical observation is implied.

Illustrative research examples only. They are not live signals or a recommendation.

Variants · same family, different risk levers

Model settings and execution rules change the result.

These methods share a broad idea, but their estimates and trading assumptions are not interchangeable.

Related strategyRelationshipWhat changesNew cost or risk
Uniform kNNEqual neighbour weightsAverages the k nearest forward labels.Sensitive to outliers and the choice of k.
Distance-weighted kNNWeighted neighboursGives closer feature states greater weight.Distance scale and zero-distance handling matter.
Rolling-window kNNAdaptive training windowDrops older observations as regimes change.A shorter window reduces sample size.
Classification thresholdDirectional labelPredicts up/down/flat classes rather than return magnitude.Class imbalance and calibration affect decisions.

This is not a KNN forecast or backtest on historical features. Research must prevent scaling leakage, overlapping labels, data mining and survivorship bias, using point-in-time data and costs.

Read beyond the summary

References

Primary sources and research used to describe the strategy and its limits.

  1. 01Krauss, Do & Huck (2017), Deep neural networks, gradient-boosted trees, random forests: Statistical arbitrage on the S&P 500.research
  2. 02Kakushadze & Serur (2018), 151 Trading Strategies.source