Indicator · Pine Script v5 · On the chart

ML KNN Predictor V2 Enhanced

by haydarkadioglu

Calculates machine learning price predictions using a weighted K-Nearest Neighbors algorithm.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code623
Settings26inputs
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 KNN Predictor V2 Enhanced evaluates price position, trend, RSI, volatility, Fair Value Gaps, Support and Resistance levels, and volume to identify similar historical pattern matches. The indicator projects price direction over a customizable prediction horizon, displays target lines and Fair Value Gap boxes on the price chart, and shows real-time predictions with confidence scores in an on-screen dashboard panel.

Details

Published by

haydarkadioglu on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

AI / machine learning, SMC / ICT / price action, Support & resistance, Screeners & dashboards

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 Neighborsint12k_neighbors
Predict N Bars Aheadint10prediction_horizon
Enable FVG Detectionbooltruefvg_enabled
Min FVG Size %float0.1fvg_min_size
FVG Lookbackint50fvg_lookback
Show FVG Boxesbooltrueshow_fvg_boxes
Enable S/R Detectionbooltruesr_enabled
Swing Lengthint5sr_swing_length
Max S/R Levelsint5sr_max_levels
Show S/R Linesbooltrueshow_sr_lines
Enable Volume Analysisbooltruevol_enabled
Show all 26 settings
SettingTypeDefaultVariable
Volume SMA Periodint20vol_period
High Volume Thresholdfloat1.5vol_threshold
Price Position Weightfloat0.12weight_price
Trend Weightfloat0.12weight_trend
RSI Weightfloat0.08weight_rsi
Volatility Weightfloat0.08weight_volatility
FVG Weightfloat0.20weight_fvg
S/R Weightfloat0.15weight_sr
Volume Weightfloat0.15weight_volume
Show Prediction Panelbooltrueshow_prediction_panel
Panel PositionstringTop Rightpanel_position
Show Target Linebooltrueshow_target_line
Show Buy/Sell Signalsbooltrueshow_signals
Min Confidence for Signals (%)int60min_confidence
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

575 stars

This overlay indicator scans a pasted list of symbols for ICT liquidity sweep patterns using prior swing sweeps. The screening method looks back one, two, or three swings and can list long and short signals in a results table with adjustable rows, position, an

Indicator v5 SMC / ICT / price actionScreeners & dashboards
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Sweep Pattern Scanner

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy
56 stars

This indicator identifies fractal-based pivot highs and lows to map out market structure directly on the price chart. It detects bullish and bearish structure breaks, automatically labeling Break of Structure (BOS) and Change of Character (ChoCH) events when p

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · None stated GitHub repository of Market Structure (Fractal)
53 stars

Apex Trend & Liquidity Master calculates a trend cloud using customizable moving averages expanded by a volatility multiplier directly on the main price chart. It identifies dynamic support and resistance liquidity zones from swing high and low pivots, extendi

Indicator v6 TrendSupport & resistance
Updated 2 months ago · MPL-2.0 GitHub repository of Apex Trend & Liquidity Master

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