Free AI and Machine Learning Pine Scripts (page 2)
Open-source Pine scripts that use machine learning ideas, such as nearest-neighbour classification, regression and adaptive filters, inside TradingView.
This overlay indicator draws Nadaraya-Watson smoothed Bollinger Bands on the price chart using short, medium, and long periods and deviations. A smoothing factor controls the kernel bandwidth, and an optional setting can allow the estimate to repaint. Users ca
Lorentzian Classification is a machine learning indicator that applies a k-nearest neighbors algorithm using Lorentzian distance to analyze market patterns. It processes configurable technical indicators, including RSI, WaveTrend, CCI, and ADX, as feature vect
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 applies a k-Nearest Neighbors machine learning algorithm to predict market direction based on historical indicator patterns. It calculates normalized values from selected technical indicators, such as RSI, ROC, CCI, and volume, across short and
Calculates machine learning price predictions using a weighted K-Nearest Neighbors algorithm. It evaluates price position, trend, RSI, volatility, Fair Value Gaps, Support and Resistance levels, and volume to identify similar historical pattern matches. The in
This indicator trains a single-neuron artificial neural network (perceptron) on each bar to classify price movement and plot an adaptive moving average on the main chart. It evaluates historical sample data to iteratively adjust weights using a step activation
This overlay strategy combines a machine-learning distance model with a MACD oscillator to open trades on the price chart. It compares recent history using cosine similarity or Euclidean and Lorentzian distance, then filters direction with selectable moving-av
This indicator collects test data for debugging Pine Script scripts. It gathers input values, output values, conditions, function calls, and edge cases into arrays. Users enable test generation and select types of tests to produce, including unit tests, integr
Fits a rolling regression of the chart's close several bars ahead on z-scored macro inputs, then plots the fitted value shifted forward so the line leads price on the chart. One feature set uses rates and cross-asset series such as US yields, the dollar index
An overlay that draws a SuperTrend-style trend line built from a volume-weighted moving average, selectable from SMA, EMA, WMA, RMA or VWMA types, with a fixed ATR factor. A k-nearest neighbours routine compares recent prices with the smoothed trend line to pr
This overlay indicator compares the current bar with historical patterns using a k-nearest neighbors search. It 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. F
This indicator uses a two-dimensional k-nearest-neighbours model on scaled oscillator values to classify the current bar as buy, sell, or hold from similar historical states. Users select RSI, ROC, CCI, momentum, or all of them, and set the neighbour count, fa
This indicator implements an artificial neural network using a single-layer perceptron model trained from scratch directly in Pine Script. It processes price features combined with a custom directional movement index across a rolling sample window to generate
This script demonstrates array manipulation in Pine Script v4 to create a 2D matrix structure for testing a neural network. It implements a basic neural network to solve the XOR logic problem. The indicator runs a configurable number of training loops using a
This strategy implements a single-layer perceptron machine learning model built from scratch to generate trading signals directly on the price chart. It calculates predictions based on sample size, threshold settings, and optional volatility or volume filters.
Calculates composite scoring across multiple technical indicators including EMAs, SuperTrend, Parabolic SAR, Hull Moving Average, RSI, MACD, WaveTrend, Stochastic, Bollinger Bands, and ATR. Trading entries trigger on the price chart when cumulative weighted sc
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
Donald - Test Logic Futures is an overlay strategy designed for intraday futures trading. It combines kernel regression functions with exponential moving averages to evaluate price retracements and entry timing. Trades are filtered by session execution windows
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
Chandelier Flip Radar plots an ATR trailing stop on the price chart and tracks a directional trend state. It holds a ratchet stop until an accepted flip, using close or wick extremums and a body filter so weak breaks do not change direction. Distance to the fl
A complex chart overlay that draws bullish, bearish and neutral forecast objects, filtered by a minimum confidence and a strategy filter such as trend following or mean reversion. It estimates the next likely pattern with a Bayesian style probability, tracks r
Classifies the market into bull, bear, range and chop regimes with a hidden Markov style model in a separate pane. Three standardised inputs, trend, volatility and ADX, are scored against configurable regime means and variances that can be pasted from an exter
Donald - AI Futures is a price-chart strategy that estimates inner and outer high-low zones and a smoothed close with rational quadratic kernel regression. It builds bullish and bearish momentum signals, optionally compares volume with a volume-weighted moving
This strategy plots an ATR Chandelier trailing stop on the price chart and tracks a directional trend state. It marks confirmed flips, weak body-rejected flips, and wick traps, and colors bars as price nears warning or danger zones around the flip trigger. Ada
A heavy strategy and chart overlay that combines an ATR-based trend core, three lookback layers, volume profile consolidation zones, harmonic, classical and candlestick pattern engines, and forecast cones with a feedback learning rate and Bayesian lookback. Op
An oscillator in a separate pane, adapted from an earlier oscillator under an open license. It smooths price with a selectable method such as DEMA, adds a signal line and marks crosses with dots. Overbought and oversold zones default to 80 and 20. Optional lay
Classifies the market into five regimes using fuzzy-logic scores built from log returns. It estimates a Hurst-like exponent from a variance ratio and measures skewness over a window whose length adapts: the more random the market looks, the shorter the window.
An indicator on the price chart that applies a k-nearest neighbours classifier to short-period RSI and moving average deviation features. Features are z-score normalised, optionally compressed with principal component analysis, and compared with a rolling trai
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
The Machine Learning Momentum Index uses a k-Nearest Neighbors classification algorithm to evaluate momentum and trend direction directly on the price chart. It records historical parameter pairs derived from weighted moving averages and smoothed RSI values, t
This multi-model strategy combines kinematic price modeling, Bayesian inference forecasts, volume profile consolidation zones, and automated pattern recognition directly on the price chart. It evaluates market trajectory using weighted kinematic regression, un
This indicator uses a k-Nearest Neighbors (kNN) machine learning algorithm to classify current market conditions based on historical indicator pairs. It evaluates combinations of fast and slow periods of RSI, Rate of Change (ROC), and Commodity Channel Index (
JAT+BSM Pro v13 Extended is a multi-timeframe trading strategy overlay that combines kinematic regression models, Bayesian inference, and consolidation zone analysis. It processes multi-layer volatility bands, volume profile buckets, and pattern structure targ
This indicator applies a logistic regression binary classification model trained via gradient descent directly on chart data. On every bar, the model updates weights over a configurable number of training iterations and passes them through a sigmoid function t
Calculates K-Means clustering on two-dimensional float data arrays directly within Pine Script. The script initializes cluster centers randomly from data points and iteratively assigns points to clusters based on Euclidean distance calculations. User settings
This indicator implements a binary logistic regression classification model retrained on each bar using gradient descent optimization. It processes normalized price features through a sigmoid activation function to classify market direction and generate direct
Function: Decision Tree is a technical script that demonstrates probabilistic path selection through a decision tree algorithm using a custom pseudo-random number generator. It initializes weighted node arrays and simulates traversal paths down the tree based
Machine Learning: Perceptron-based Strategy is a Pine Script overlay indicator intended to implement a simple perceptron machine learning model for signal generation. However, the author deleted the underlying script logic from the source file, leaving only th
An indicator that builds a feature matrix from price z-score, RSI, ATR ratio and momentum over a lookback window, weights the four features, smooths them with a covariance based decomposition, and classifies a regime. It then draws a forecast line a chosen num
This indicator applies the Goertzel algorithm, a signal-processing method for measuring a single frequency component, to price in a separate pane. A period length and a measurement block length set the cycle to test, and a training percentage and shift setting
This indicator applies the Goertzel algorithm to price in a separate pane, measuring one frequency component set by a period length and a measurement block length. A training percentage and shift settings align the fitted wave with recent data, and the wave ex
A complex strategy that mixes a volatility-based trend model, MACD with an optional relaxed mode, candlestick and chart pattern labels, consolidation zones with volume profile, and forecast projections with a Bayesian style hit tracker. Inputs include pattern
This indicator combines a dynamic Seasonal Random Index (SRI) with a dynamic Karobein Oscillator and a pattern-similarity search algorithm in a separate pane. It normalizes SRI into seasoned and deseasoned series, shading the area green or red to signal trend
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
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.
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 Pine Script v5 library exposes methods for a generalized neural network. It builds random weight arrays, runs a forward pass through stacked layers using an imported layer function, and begins a backward pass that compares output nodes with targets. Calle
Third-party code. ForexR lists open-source Pine scripts from GitHub; it did not write, test or endorse them, and their summaries are generated automatically from each script's code and README. Indicators describe the past, and a strategy's backtest can look better than live trading. Check a script on a demo account before you rely on it. CFDs and leveraged forex are complex instruments with a high risk of losing money rapidly.
Learn to Use Pine Scripts
Free, plain-English guides: add a script to TradingView, read what it does, test it and avoid the common traps.