Indicator · Pine Script v5 · On the chart

Machine Learning Momentum Index (MLMI)

by suyons· code credited to Zeiierman

The Machine Learning Momentum Index uses a k-Nearest Neighbors classification algorithm to evaluate momentum and trend direction directly on the price chart.

View on GitHub

GitHub stars7on the repository
Pine versionv5runs as is
Lines of code126
Settings3inputs
LicenceNone stated
Last update4 months ago21 Jun 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 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.

Details

Published by

suyons on GitHub

Code credit

Zeiierman, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

AI / machine learning, Oscillators & momentum, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Prediction Data (k)int200numNeighbors
Trend Lengthint20momentumWindow
Signal Lookbackint10sig_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.

Similar Pine Scripts

257 stars

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

Indicator v5 AI / machine learningOscillators & momentum
Updated 6 weeks ago · None stated GitHub repository of Donald - Machine Learning Options

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

Indicator v4 AI / machine learningTrend Repaints
Updated 1 year ago · None stated GitHub repository of Machine Learning: kNN-based Strategy (aroon)

Machine Learning: Lorentzian Classification

by artificial-intelligence-edge
75 stars

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

Indicator v6 AI / machine learningOscillators & momentum
Updated 2 days ago · MIT GitHub repository of Machine Learning: Lorentzian Classification

kNN Classifier

by jayadevrana
1 stars

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

Indicator v6 AI / machine learningTrend
Updated 2 days ago · MPL-2.0 GitHub repository of kNN Classifier

ML Decision Tree Classifier

by haydarkadioglu
1 stars

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

Indicator v5 AI / machine learningTrend
Updated 8 months ago · None stated GitHub repository of ML Decision Tree Classifier

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

Indicator v5 TrendVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of AI SuperTrend Clustering Oscillator [LuxAlgo]

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers