The Machine Learning Momentum Index uses a k-Nearest Neighbors classification algorithm to evaluate momentum and trend direction directly on the price chart.
1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.
Overview
Machine Learning Momentum Index (MLMI) records historical parameter pairs derived from weighted moving averages and smoothed RSI values, then calculates Euclidean distances to predict current market direction based on similar past conditions. Users can adjust the neighbor count, trend window length, and signal lookback periods to adjust responsiveness and signal filtering.
k-Nearest Neighbors classification model
Weighted moving average and RSI signal conditions
Adjustable prediction data neighbor count
Customizable trend length and signal lookback limits
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Prediction Data (k)
int
200
numNeighbors
Trend Length
int
20
momentumWindow
Signal Lookback
int
10
sig_lookback
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 applies a k-nearest neighbours (kNN) classification algorithm using Aroon indicator lags and momentum as feature inputs to forecast market direction. It compares current values against historical feature sets to classify bars into buy, hold, or
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 implements a k-nearest neighbours classification model to forecast price direction several bars ahead. It extracts three normalized technical features: RSI, an EMA spread scaled by ATR, and normalized candle range volatility. Historical samples
The ML Decision Tree Classifier uses rule-based decision tree logic to evaluate trend, momentum, volume, and MACD indicators for market direction classification. It calculates exponential moving averages, relative strength index values, volume relative to a mo
This indicator plots an oscillator in a separate pane. It builds several SuperTrend series across a user-defined factor range and step, using ATR as the band width. On each bar it measures the distance between the close and each SuperTrend output, then groups