A kNN Forecast Oscillator for Trend Regime and Crossover Signals
Summary
This indicator estimates a near-term price move by comparing recent feature patterns with a rolling store of historical patterns. It represents each pattern with four inputs: one-bar log returns, five-bar price change, RSI centered around its midpoint, and the gap between fast and slow EMAs. A distance calculation weights these features equally, and the closest stored examples contribute to the forecast, with weights adjusted by their distances.
The forecast is smoothed into an oscillator and signal line. Their crossovers, zero-line crossings, histogram shifts, and a separate ATR-banded regime state can be displayed or used for alerts. The script exposes pattern length, memory size, neighbor count, and smoothing controls, but supplies no performance evaluation, calibration method, or evidence that the forecast predicts returns reliably. Its usefulness may depend on the asset, timeframe, and parameter choices; the displayed signals are indicators rather than a tested trading system.
Key ideas
- The forecast compares four normalized price and indicator features against a limited rolling history of patterns.
- The prediction averages outcomes associated with the nearest historical matches, weighted by their distances.
- EMA smoothing, a signal line, and a histogram turn the estimate into crossover and zero-line signals.
- An ATR-banded rule separately labels bullish and bearish regimes.
- The script provides configurable parameters but no backtest results or 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.