Machine Learning: kNN (New Approach) analyzes sequences of historical price data points to locate similar patterns and averages nearest neighbor matches. Users can adjust the timeframe resolution, pattern length, neighbor count, and enable add-on calculations like Z-Scores or Pivot Points. It plots directly on the price chart. By default, the non-repainting option is disabled, causing calculations to update on live bars.
k-Nearest Neighbors algorithmic price prediction
Configurable pattern length and K nearest neighbors
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Resolution
timeframe
5
TF
# of Data Points [2:n]
int
10
N
# of Nearest Neighbors (K) [1:252]
int
100
K
Adjust Prediction
bool
true
ADJ
Non-Repainting
bool
false
REP
Add-On
string
Z-Score
ADDON
Pivot Point Lag [2:n] if selected
int
5
LAGP
Z-Score Lag [2:n] if selected
int
20
LAGZ
Show Outcomes
string
Both
DISP
Projection Base
source
hlcc4
ODS
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator uses a Lorentzian distance k-nearest neighbors classification algorithm to predict market direction based on up to five technical features, such as RSI, WaveTrend, CCI, and ADX. It compares current feature values against historical bar patterns
This indicator calculates a locally weighted regression curve alongside a standard linear regression line to detect directional price shifts. It identifies potential buy signals when the weighted line crosses below the linear regression while falling over a de
This indicator calculates a trend direction and smoothed moving average using a k-nearest neighbours (k-NN) classification algorithm directly on the main price chart. Users can select input price types, target values, neighborhood size, and smoothing periods.
An overlay indicator that applies a k-nearest-neighbors machine learning classifier using Lorentzian distance to predict price movement. It evaluates historical market features, such as RSI, WaveTrend, CCI, and ADX, to identify similar price-time patterns and
This indicator uses a Hidden Markov Model (HMM) framework combined with an adaptive dual moving average engine and Directional Movement Index (DMI) features to identify market regimes (bullish, bearish, or ranging/chop). It calculates regime probabilities on e
This overlay indicator plots a SuperTrend-style band on the price chart using ATR length, a selectable source, and a base factor. Optional settings enable an adaptive factor driven by rate of change, a volatility filter, K-means clustering, and an LSTM layer w