Indicator · Pine Script v5 · On the chart

ML Price Predictor (KNN)

by haydarkadioglu

This overlay indicator compares the current bar with historical patterns using a k-nearest neighbors search.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code330
Settings14inputs
LicenceNone stated
Last update8 months ago17 Feb 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

ML Price Predictor (KNN) measures RSI, RSI slope, volume relative to a 20-bar average, EMA trend strength, and price position within a range, each scaled by a user weight. From the nearest matches it estimates direction and a target several bars ahead, then draws a label, an optional target line, EMA lines, and buy or sell markers when confidence meets a minimum. A confidence histogram can be shown. No stop, exit, or position rules are included because it is an indicator.

Details

Published by

haydarkadioglu on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

AI / machine learning, Oscillators & momentum, Volume, Moving averages

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
Historical Lookback Barsint100lookback_bars
K Nearest Neighborsint10k_neighbors
Predict N Bars Aheadint10prediction_horizon
RSI Weightfloat1.0weight_rsi
Volume Weightfloat0.8weight_volume
Trend Weightfloat1.2weight_trend
Price Position Weightfloat1.0weight_price_pos
Show Prediction Labelbooltrueshow_prediction_label
Panel PositionstringTop Rightpanel_position
Show Target Price Linebooltrueshow_target_line
Show Buy/Sell Signalsbooltrueshow_signals
Min Confidence for Signals (%)int50min_confidence
Show all 14 settings
SettingTypeDefaultVariable
Show EMA Linesbooltrueshow_ema
Show Confidence Histogramboolfalseshow_conf_histogram
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

LiqSpikeBounceLong Feb2026

by agutinbaigo28
147 stars

LiqSpikeBounceLong Feb2026 is an indicator designed to identify long bounce entries following high-volume liquidation cascades in bearish market contexts. It checks if price is below an exponential moving average, then detects large single-bar drops exceeding

Indicator v5 Volatility & bandsVolume
Updated 6 weeks ago · MIT GitHub repository of LiqSpikeBounceLong Feb2026
114 stars

Volume Weighted Distance applies statistical and machine learning distance metrics between source prices and their rolling mean, weighted by volume, to identify local trend reversals. Users can select from Manhattan, Euclidean, Mahalanobis, Cosine Similarity,

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Volume Weighted Distance

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 3 days ago · MIT GitHub repository of Signal Strategy 15m
46 stars

This overlay indicator plots a SuperTrend using a 10-period ATR with a multiplier of 3, drawing up and down stop lines and a faint trend fill on the price chart. It compares a 9-period EMA with an 18-period EMA and a 12/26/9 MACD against its signal, and it req

Indicator v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of SuperTrend + MACD + EMA

Bte Acc

by f-cksociety
11 stars

Bte Acc is a chart indicator form of the PineCoders Backtesting and Trading Engine. It seeks an entry trigger from a main or alternate entry method, then checks trade direction, filters, date range, ATR readiness, and remaining capital before filling on the ne

Indicator v5 TrendOscillators & momentum Repaints
Updated 4 years ago · MPL-2.0 GitHub repository of Bte Acc

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