Re: Something interesting from Chatgpt/AI please post here

371
Pelle wrote: Sun Jan 18, 2026 4:11 am Reversal Detection with Dynamic Stops - Multi-EMA Zigzag System by NPR21
https://www.tradingview.com/script/tC3V ... MA-Zigzag/
Hi Pelle,

Thank's for share this 'Reversal Detection ...
based 'Zig Zag' Concept.

I think Smart Money Volume Index [AlgoAlpha]
based Volume more Accurate than Zig Zag.
It more interesting to Convert MT4 indicator.
This script measures buying and selling interest by comparing how price behaves on rising volume versus falling volume. It separates what is often called “smart money” activity from more passive volume and turns that relationship into a normalized index. The result is an oscillator that shows whether buyers or sellers are in control, how strong that control is, and when interest reaches extreme levels that tend to matter for reversals or continuations.
It's NEW Posted by AlgiAlpha 21 Hours ago...

I will appreciate if you have provide plenty of time & like to Convert MT4.

LINK :
https://www.tradingview.com/script/WBJh ... AlgoAlpha/
Always looking the GREAT, never left GOOD Point...


Re: Something interesting from Chatgpt/AI please post here

372
Tsar wrote: Sun Jan 18, 2026 4:51 am Hi Pelle,

Thank's for share this 'Reversal Detection ...
based 'Zig Zag' Concept.

I think Smart Money Volume Index [AlgoAlpha]
based Volume more Accurate than Zig Zag.
It more interesting to Convert MT4 indicator.



It's NEW Posted by AlgiAlpha 21 Hours ago...

I will appreciate if you have provide plenty of time & like to Convert MT4.

LINK :
https://www.tradingview.com/script/WBJh ... AlgoAlpha/
Open a free tradingview chart and add that indicator there.

I looked at it today, but it wasn't convincing.

Re: Something interesting from Chatgpt/AI please post here

374
SdW25 wrote: Sun Jan 18, 2026 5:47 am Here’s something interesting from ChatGPT/AI 🤖
I put together an AI-inspired scalping strategy — rules-based, minimal indicators, focused on high-liquidity sessions and quick feedback loops.

It’s purely educational and designed to show how “AI thinking” (filters, confluence, risk caps) can be applied to discretionary trading.
Malwarebytes
www.malwarebytes.com

-Log Details-
Scan Date: 1/17/2026
Scan Time: 10:14 PM
Log File: 2bcea804-f3e1-11f0-85f3-00ff6b4b2d2e.json

-Software Information-
Version: 5.4.6.227
Components Version: 147.0.5453
Update Package Version: 1.0.106531
License: Free

-Scan Summary-
Scan Type: Custom Scan
Scan Initiated By: Manual
Result: Completed
Objects Scanned: 2
Threats Detected: 1
Threats Quarantined: 1
Time Elapsed: 0 min, 32 sec

-Scan Options-
Memory: Disabled
Startup: Disabled
File system: Enabled
Archives: Enabled
Rootkits: Disabled
Heuristics: Enabled
PUP: Detect
PUM: Detect

-Scan Details-
Process: 0
(No malicious items detected)

Module: 0
(No malicious items detected)

Registry Key: 0
(No malicious items detected)

Registry Value: 0
(No malicious items detected)

Registry Data: 0
(No malicious items detected)

Data Stream: 0
(No malicious items detected)

Folder: 0
(No malicious items detected)

File: 1
Trojan.Injector.AutoIt, C:\USERS\BERNS\DOWNLOADS\UNIQUE_SCALPING_STRATEGY.PIF, Quarantined, 3183, 1215261, 1.0.106531, , ame, , C81B9A5D27E091C37C474EA3687DDB4B, A83A8C7B0C0448F9DDB7C5487BEC592F8189FABCBB97A25269094A6406225BC4

Physical Sector: 0
(No malicious items detected)

WMI: 0
(No malicious items detected)


(end)
These users thanked the author BeatlemaniaSA for the post (total 2):
ahhbii88, Jimmy
Rating: 1.2%
Millionaire Maker - “Amateurs chase. Professionals wait. Legends wait with a plan.”

BEATS V5 - "Enjoy The Quiet Between Trades”
Improve Your Trading Psychology - No fear, no doubt
Ultimate Risk Management - Maximize Your Trades
Supply and Demand Course - Learn Supply and Demand

Re: Something interesting from Chatgpt/AI please post here

375
@Jimmy,

Ban this user @SdW25 for intentionally uploading a virus-infected PDF file. :exclaim:
These users thanked the author BeatlemaniaSA for the post (total 6):
kvak, Cagliostro, Jimmy, Tsar, ahhbii88, JohnL33
Rating: 3.6%
Millionaire Maker - “Amateurs chase. Professionals wait. Legends wait with a plan.”

BEATS V5 - "Enjoy The Quiet Between Trades”
Improve Your Trading Psychology - No fear, no doubt
Ultimate Risk Management - Maximize Your Trades
Supply and Demand Course - Learn Supply and Demand


Re: Something interesting from Chatgpt/AI please post here

376
Tsar wrote: Sun Jan 18, 2026 4:51 am Hi Pelle,

Thank's for share this 'Reversal Detection ...
based 'Zig Zag' Concept.

I think Smart Money Volume Index [AlgoAlpha]
based Volume more Accurate than Zig Zag.
It more interesting to Convert MT4 indicator.



It's NEW Posted by AlgiAlpha 21 Hours ago...

I will appreciate if you have provide plenty of time & like to Convert MT4.

LINK :
https://www.tradingview.com/script/WBJh ... AlgoAlpha/
Pelle wrote: Sun Jan 18, 2026 5:30 am Open a free tradingview chart and add that indicator there.

I looked at it today, but it wasn't convincing.
Here the Picture in M15 TF which I take from TradingView (TV) Terminal :

The ORIGINAL use H4 Chart :



Smart Money Volume Index [AlgoAlpha] - M15 Chart



Smart Money Volume Index [AlgoAlpha] - M15 Full



And the PARAMETERS :

Money Volume Index [AlgoAlpha] - Inputs



Money Volume Index [AlgoAlpha] - Style



Money Volume Index [AlgoAlpha] - Visibility



These Smart Money Volume Index [AlgoAlpha] ~ Scripts

Code: Select all

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © AlgoAlpha

//@version=6
indicator("Smart Money Volume Index [AlgoAlpha]", "AlgoAlpha - Smart Money", explicit_plot_zorder = true, behind_chart=false)
mode = input.string("Net", "Display Mode", options = ["Compare", "Net"], group = "Settings", tooltip = "Choose between 'Compare' to see buy/sell interest separately, or 'Net' for a single oscillator.")
x = input.int(25, "Index Period", minval = 1, group = "Settings", tooltip = "Length of the summation period for the interest index.")
rr = input.int(14, "Volume Flow Period", minval = 1, group = "Settings", tooltip = "RSI period applied to the volume flow calculations.")
peakslen = input.int(500, "Normalization Period", minval = 1, group = "Settings", tooltip = "Lookback period for finding the peak value to normalize the index.")
thr = input.float(0.9, "High Interest Threshold", minval = 0.01, maxval = 0.99, step = 0.05, group = "Settings", tooltip = "Level at which interest is considered 'High'. Triggers alerts and highlights.")

green = input.color(#00ffbb, "Up Color", group = "Colors", tooltip = "Main color for Buying Interest.")
sec_green = input.color(#008461, "Secondary Up Color", group = "Colors", tooltip = "Secondary color for Net Buy layers.")
red = input.color(#ff1100, "Down Color", group = "Colors", tooltip = "Main color for Selling Interest.")
sec_red = input.color(#840900, "Secondary Down Color", group = "Colors", tooltip = "Secondary color for Net Sell layers.")

dumb = ta.pvi-ta.ema(ta.pvi,255)
smart = ta.nvi-ta.ema(ta.nvi,255)

drsi = ta.rsi(dumb, rr)
srsi = ta.rsi(smart, rr)

r_buy = srsi / drsi //ratio shows if smart money is buying from dumb money selling
r_sell = (100 - srsi) / (100 - drsi) //ratio shows if dumb money is buying from smart money selling

sums_buy = math.sum(r_buy, x)
sums_sell = math.sum(r_sell, x)
peak = ta.highest(math.max(sums_buy, sums_sell), peakslen)

index_buy = sums_buy / peak
index_sell = sums_sell / peak
net_index = index_buy - index_sell

bottom = plot(0, "Zero Line", color = color.gray)
top = plot(1, "Top Limit", display = display.none)
low_ = plot(-1, "Bottom Limit", display = display.none)

thresh_up = plot(thr, "High Buy Threshold", display = display.none)
thresh_down = plot(-thr, "High Sell Threshold", display = display.none)

plot_buy = mode == "Compare" ? index_buy : na
plot_sell = mode == "Compare" ? -index_sell : na

i_buy = plot(plot_buy, "Buy Interest", color = green, style = plot.style_linebr)
i_sell = plot(plot_sell, "Sell Interest", color = red, style = plot.style_linebr)

// Net Mode Layered Columns
transp = 20
n_up = mode == "Net" and net_index > 0 ? net_index : na
n_dn = mode == "Net" and net_index < 0 ? net_index : na

plot(n_up, "Net Buy 100", color = color.new(sec_green, transp + 60), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.8, "Net Buy 80", color = color.new(sec_green, transp + 55), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.6, "Net Buy 60", color = color.new(sec_green, transp + 45), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.4, "Net Buy 40", color = color.new(sec_green, transp + 30), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.2, "Net Buy 20", color = color.new(sec_green, transp + 25), style = plot.style_columns, linewidth = 4)

plot(n_up, "Net Buy Line", color = color.new(green, transp), style = plot.style_linebr)

plot(n_dn, "Net Sell 100", color = color.new(sec_red, transp + 60), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.8, "Net Sell 80", color = color.new(sec_red, transp + 55), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.6, "Net Sell 60", color = color.new(sec_red, transp + 45), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.4, "Net Sell 40", color = color.new(sec_red, transp + 30), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.2, "Net Sell 20", color = color.new(sec_red, transp + 25), style = plot.style_columns, linewidth = 4)

plot(n_dn, "Net Sell Line", color = color.new(red, transp), style = plot.style_linebr)

v_up = mode == "Compare" ? index_buy : net_index
v_dn = mode == "Compare" ? -index_sell : net_index
top_active = v_up > 0.7
bot_active = v_dn < -0.7

fill(thresh_up, top, 1, thr, top_active ? color.new(chart.fg_color, 45) : color.new(chart.fg_color, 90), top_active ? color.new(chart.fg_color, 30) : color.new(chart.fg_color, 60))
fill(thresh_down, low_, -thr, -1, bot_active ? color.new(chart.fg_color, 30) : color.new(chart.fg_color, 60), bot_active ? color.new(chart.fg_color, 45) : color.new(chart.fg_color, 90))

fill(bottom, i_buy, plot_buy, 0, green, chart.bg_color)
fill(bottom, i_sell, plot_sell, 0, red, chart.bg_color)

sig_buy = mode == "Compare" ? index_buy : net_index
sig_sell = mode == "Compare" ? index_sell : -net_index

abs_net = math.abs(net_index)
net_color = net_index > 0 ? color.from_gradient(abs_net, 0, 1, chart.bg_color, green) : color.from_gradient(abs_net, 0, 1, chart.bg_color, red)
comp_color = sig_buy > thr ? green : sig_sell > thr ? red : na

candle_color = mode == "Net" ? net_color : comp_color
plotcandle(open, high, low, close, "Smart Money Candles", color = candle_color, wickcolor = candle_color, bordercolor = candle_color, force_overlay = true)
plot(close, "Price Tracking line", color = color.new(chart.fg_color, 85), force_overlay = true)

///Alerts
alertcondition(ta.crossover(sig_buy, thr), "High Smart Money Buy Interest")
alertcondition(ta.crossover(sig_sell, thr), "High Smart Money Sell Interest")
alertcondition(ta.crossunder(sig_buy, thr), "Smart Money Buy Interest no longer high")
alertcondition(ta.crossunder(sig_sell, thr), "Smart Money Sell Interest no longer high")
alertcondition(ta.crossover(sig_buy, 0), "Smart Money Buy Interest turned positive")
alertcondition(ta.crossunder(sig_buy, 0), "Smart Money Buy Interest turned negative")
alertcondition(ta.crossover(sig_sell, 0), "Smart Money Sell Interest turned positive")
alertcondition(ta.crossunder(sig_sell, 0), "Smart Money Sell Interest turned negative")
alertcondition(ta.crossover(v_up, 0.7), "Smart Money Buy Interest entered high zone")
alertcondition(ta.crossunder(v_up, 0.7), "Smart Money Buy Interest exited high zone")

I given Completely... :)
I wish you can found the Benefits from this Script.
Always looking the GREAT, never left GOOD Point...

Re: Something interesting from Chatgpt/AI please post here

377
BeatlemaniaSA wrote: Sun Jan 18, 2026 7:31 am @Jimmy,

Ban this user @SdW25 for intentionally uploading a virus-infected PDF file. :exclaim:
Thanks Beatle, got him.

IP address for reference: 51.75.188.41
These users thanked the author Jimmy for the post (total 3):
ahhbii88, Abdi, kvak
Rating: 1.8%
Myfxbook live trading results 📊

List of our most powerful reversal indicators + Guide to the "All Averages" Filters (ADXvma, Laguerre etc.)
Fibonacci numbers for indicator settings + How to draw Fibonacci Extensions + How to draw Support & Resistance

Re: Something interesting from Chatgpt/AI please post here

378
Tsar wrote: Sun Jan 18, 2026 9:42 am Here the Picture in M15 TF which I take from TradingView (TV) Terminal :

The ORIGINAL use H4 Chart :


Smart Money Volume Index [AlgoAlpha] - ORIGINAL TV.jpg



Smart Money Volume Index [AlgoAlpha] - M15 Chart


Smart Money Volume Index [AlgoAlpha] - M15 Chart.jpg



Smart Money Volume Index [AlgoAlpha] - M15 Full


Smart Money Volume Index [AlgoAlpha] M15 Full.jpg



And the PARAMETERS :

Money Volume Index [AlgoAlpha] - Inputs


Smart Money Volume Index [AlgoAlpha] - Inputs.jpg



Money Volume Index [AlgoAlpha] - Style


Money Volume Index [AlgoAlpha] - Style.jpg



Money Volume Index [AlgoAlpha] - Visibility


Money Volume Index [AlgoAlpha] - Visibility.jpg



These Smart Money Volume Index [AlgoAlpha] ~ Scripts

Code: Select all

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © AlgoAlpha

//@version=6
indicator("Smart Money Volume Index [AlgoAlpha]", "AlgoAlpha - Smart Money", explicit_plot_zorder = true, behind_chart=false)
mode = input.string("Net", "Display Mode", options = ["Compare", "Net"], group = "Settings", tooltip = "Choose between 'Compare' to see buy/sell interest separately, or 'Net' for a single oscillator.")
x = input.int(25, "Index Period", minval = 1, group = "Settings", tooltip = "Length of the summation period for the interest index.")
rr = input.int(14, "Volume Flow Period", minval = 1, group = "Settings", tooltip = "RSI period applied to the volume flow calculations.")
peakslen = input.int(500, "Normalization Period", minval = 1, group = "Settings", tooltip = "Lookback period for finding the peak value to normalize the index.")
thr = input.float(0.9, "High Interest Threshold", minval = 0.01, maxval = 0.99, step = 0.05, group = "Settings", tooltip = "Level at which interest is considered 'High'. Triggers alerts and highlights.")

green = input.color(#00ffbb, "Up Color", group = "Colors", tooltip = "Main color for Buying Interest.")
sec_green = input.color(#008461, "Secondary Up Color", group = "Colors", tooltip = "Secondary color for Net Buy layers.")
red = input.color(#ff1100, "Down Color", group = "Colors", tooltip = "Main color for Selling Interest.")
sec_red = input.color(#840900, "Secondary Down Color", group = "Colors", tooltip = "Secondary color for Net Sell layers.")

dumb = ta.pvi-ta.ema(ta.pvi,255)
smart = ta.nvi-ta.ema(ta.nvi,255)

drsi = ta.rsi(dumb, rr)
srsi = ta.rsi(smart, rr)

r_buy = srsi / drsi //ratio shows if smart money is buying from dumb money selling
r_sell = (100 - srsi) / (100 - drsi) //ratio shows if dumb money is buying from smart money selling

sums_buy = math.sum(r_buy, x)
sums_sell = math.sum(r_sell, x)
peak = ta.highest(math.max(sums_buy, sums_sell), peakslen)

index_buy = sums_buy / peak
index_sell = sums_sell / peak
net_index = index_buy - index_sell

bottom = plot(0, "Zero Line", color = color.gray)
top = plot(1, "Top Limit", display = display.none)
low_ = plot(-1, "Bottom Limit", display = display.none)

thresh_up = plot(thr, "High Buy Threshold", display = display.none)
thresh_down = plot(-thr, "High Sell Threshold", display = display.none)

plot_buy = mode == "Compare" ? index_buy : na
plot_sell = mode == "Compare" ? -index_sell : na

i_buy = plot(plot_buy, "Buy Interest", color = green, style = plot.style_linebr)
i_sell = plot(plot_sell, "Sell Interest", color = red, style = plot.style_linebr)

// Net Mode Layered Columns
transp = 20
n_up = mode == "Net" and net_index > 0 ? net_index : na
n_dn = mode == "Net" and net_index < 0 ? net_index : na

plot(n_up, "Net Buy 100", color = color.new(sec_green, transp + 60), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.8, "Net Buy 80", color = color.new(sec_green, transp + 55), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.6, "Net Buy 60", color = color.new(sec_green, transp + 45), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.4, "Net Buy 40", color = color.new(sec_green, transp + 30), style = plot.style_columns, linewidth = 4)
plot(n_up * 0.2, "Net Buy 20", color = color.new(sec_green, transp + 25), style = plot.style_columns, linewidth = 4)

plot(n_up, "Net Buy Line", color = color.new(green, transp), style = plot.style_linebr)

plot(n_dn, "Net Sell 100", color = color.new(sec_red, transp + 60), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.8, "Net Sell 80", color = color.new(sec_red, transp + 55), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.6, "Net Sell 60", color = color.new(sec_red, transp + 45), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.4, "Net Sell 40", color = color.new(sec_red, transp + 30), style = plot.style_columns, linewidth = 4)
plot(n_dn * 0.2, "Net Sell 20", color = color.new(sec_red, transp + 25), style = plot.style_columns, linewidth = 4)

plot(n_dn, "Net Sell Line", color = color.new(red, transp), style = plot.style_linebr)

v_up = mode == "Compare" ? index_buy : net_index
v_dn = mode == "Compare" ? -index_sell : net_index
top_active = v_up > 0.7
bot_active = v_dn < -0.7

fill(thresh_up, top, 1, thr, top_active ? color.new(chart.fg_color, 45) : color.new(chart.fg_color, 90), top_active ? color.new(chart.fg_color, 30) : color.new(chart.fg_color, 60))
fill(thresh_down, low_, -thr, -1, bot_active ? color.new(chart.fg_color, 30) : color.new(chart.fg_color, 60), bot_active ? color.new(chart.fg_color, 45) : color.new(chart.fg_color, 90))

fill(bottom, i_buy, plot_buy, 0, green, chart.bg_color)
fill(bottom, i_sell, plot_sell, 0, red, chart.bg_color)

sig_buy = mode == "Compare" ? index_buy : net_index
sig_sell = mode == "Compare" ? index_sell : -net_index

abs_net = math.abs(net_index)
net_color = net_index > 0 ? color.from_gradient(abs_net, 0, 1, chart.bg_color, green) : color.from_gradient(abs_net, 0, 1, chart.bg_color, red)
comp_color = sig_buy > thr ? green : sig_sell > thr ? red : na

candle_color = mode == "Net" ? net_color : comp_color
plotcandle(open, high, low, close, "Smart Money Candles", color = candle_color, wickcolor = candle_color, bordercolor = candle_color, force_overlay = true)
plot(close, "Price Tracking line", color = color.new(chart.fg_color, 85), force_overlay = true)

///Alerts
alertcondition(ta.crossover(sig_buy, thr), "High Smart Money Buy Interest")
alertcondition(ta.crossover(sig_sell, thr), "High Smart Money Sell Interest")
alertcondition(ta.crossunder(sig_buy, thr), "Smart Money Buy Interest no longer high")
alertcondition(ta.crossunder(sig_sell, thr), "Smart Money Sell Interest no longer high")
alertcondition(ta.crossover(sig_buy, 0), "Smart Money Buy Interest turned positive")
alertcondition(ta.crossunder(sig_buy, 0), "Smart Money Buy Interest turned negative")
alertcondition(ta.crossover(sig_sell, 0), "Smart Money Sell Interest turned positive")
alertcondition(ta.crossunder(sig_sell, 0), "Smart Money Sell Interest turned negative")
alertcondition(ta.crossover(v_up, 0.7), "Smart Money Buy Interest entered high zone")
alertcondition(ta.crossunder(v_up, 0.7), "Smart Money Buy Interest exited high zone")

I given Completely... :)
I wish you can found the Benefits from this Script.
It's not fully functional. But I'll provide the tpl and source code to get you started and make it better.
These users thanked the author Pelle for the post (total 2):
Tsar, moey_dw
Rating: 1.2%

Re: Something interesting from Chatgpt/AI please post here

379
Pelle wrote: Sun Jan 18, 2026 11:00 pm It's not fully functional. But I'll provide the tpl and source code to get you started and make it better.
Dear Pelle,

Thank's a Lot to made Convert to MT4 indicator :In Love:

Yes... I know it with Clear. It can NOT Perfecly or the Same 100% like Indicator in TV's.
Because Defferent the Terminal and the Language too...

Just need the Same the Concept it Enough !


MEMO :
I 'm not a Coder. Just a Trader (only)
Always looking the GREAT, never left GOOD Point...

DislikeRe: Something interesting from Chatgpt/AI please post here

380
AI_Trend_Navigator


Created by AI but 'still' improved by Humans (Expert Coders)



In the evolving landscape of trading and investment, the demand for sophisticated and reliable tools is ever-growing. The AI Trend Navigator [K-Neighbor] is an indicator designed to meet this demand, providing valuable insights into market trends and potential future price movements. The AI Trend Navigator [K-Neighbor] indicator is designed to predict market trends using the k-Nearest Neighbors (KNN) classifier.

By intelligently analyzing recent price actions and emphasizing similar values, it helps traders to navigate complex market conditions with confidence. It provides an advanced way to analyze trends, offering potentially more accurate predictions compared to simpler trend-following methods.


Code: Select all

// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © Zeiierman {

//@version=5
indicator('AI Trend Navigator', overlay=true)

// ~~ Tooltips {
t1 ="PriceValue selects the method of price computation. \n\nSets the smoothing period for the PriceValue. \n\nAdjusting these settings will change the input values for the K-Nearest Neighbors algorithm, influencing how the trend is calculated."
t2 = "TargetValue specifies the target to evaluate. \n\nSets the smoothing period for the TargetValue."
t3 ="numberOfClosestValues sets the number of closest values that are considered when calculating the KNN Moving Average. Adjusting this number will affect the sensitivity of the trend line, with a higher value leading to a smoother line and a lower value resulting in a line that is more responsive to recent price changes."
t4 ="smoothingPeriod sets the period for the moving average applied to the KNN classifier. Adjusting the smoothing period will affect how rapidly the trend line responds to price changes, with a larger smoothing period leading to a smoother line that may lag recent price movements, and a smaller smoothing period resulting in a line that more closely tracks recent changes."
t5 ="This option controls the background color for the trend prediction. Enabling it will change the background color based on the prediction, providing visual cues on the direction of the trend. A green color indicates a positive prediction, while red indicates a negative prediction."
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Inputs {
PriceValue   = input.string("hl2", options = ["hl2","VWAP", "sma", "wma", "ema", "hma"], group="", inline="Value")
maLen        = input.int(5, minval=2, maxval=200, title="", group="", inline="Value", tooltip=t1)
TargetValue  = input.string("Price Action", options = ["Price Action","VWAP", "Volatility", "sma", "wma", "ema", "hma"], group="", inline="Target")
maLen_       = input.int(5, minval=2, maxval=200, title="", group="", inline="Target", tooltip=t2)
// Input parameters for the KNN Moving Average
numberOfClosestValues = input.int(3, "Number of Closest Values", 2, 200, tooltip=t3) 
smoothingPeriod       = input.int(50, "Smoothing Period", 2, 500, tooltip=t4) 
windowSize            = math.max(numberOfClosestValues, 30) 

// knn Color
Upknn_col   = input.color(color.lime, title="", group="KNN Color", inline="knn col")
Dnknn_col   = input.color(color.red, title="", group="KNN Color", inline="knn col")
Neuknn_col  = input.color(color.orange, title="", group="KNN Color", inline="knn col")
// MA knn Color
Maknn_col   = input.color(color.teal, title="", group="MA KNN Color", inline="MA knn col")
// BG Color
bgcolor = input.bool(false, title="Trend Prediction Color", group="BG Color", inline="bg", tooltip=t5)
Up_col  = input.color(color.lime, title="", group="BG Color", inline="bg")
Dn_col  = input.color(color.red, title="", group="BG Color", inline="bg")
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ kNN Classifier {
value_in = switch PriceValue
    "hl2"  => ta.sma(hl2,maLen)
    "VWAP" => ta.vwap(close[maLen])
    "sma" => ta.sma(close,maLen)
    "wma" => ta.wma(close,maLen)
    "ema" => ta.ema(close,maLen)
    "hma" => ta.hma(close,maLen)

meanOfKClosest(value_,target_) => 
    closestDistances = array.new_float(numberOfClosestValues, 1e10) 
    closestValues    = array.new_float(numberOfClosestValues, 0.0) 
    for i = 1 to windowSize 
        value = value_[i] 
        distance = math.abs(target_ - value) 
        maxDistIndex = 0 
        maxDistValue = closestDistances.get(0) 
        for j = 1 to numberOfClosestValues - 1 
            if closestDistances.get(j) > maxDistValue
                maxDistIndex := j
                maxDistValue := closestDistances.get(j)
        if distance < maxDistValue 
            closestDistances.set(maxDistIndex, distance)
            closestValues.set(maxDistIndex, value)
    closestValues.sum() / numberOfClosestValues 

// Choose the target input based on user selection
target_in = switch TargetValue
    "Price Action"  => ta.rma(close,maLen_) 
    "VWAP"          => ta.vwap(close[maLen_])
    "Volatility"    => ta.atr(14)
    "sma" => ta.sma(close,maLen_)
    "wma" => ta.wma(close,maLen_)
    "ema" => ta.ema(close,maLen_)
    "hma" => ta.hma(close,maLen_)

knnMA = meanOfKClosest(value_in,target_in)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ kNN Prediction {
// Function to calculate KNN Classifier
price = math.avg(knnMA, close)
c     = ta.rma(knnMA[1], smoothingPeriod) 
o     = ta.rma(knnMA, smoothingPeriod)

// Defines KNN function to perform classification
knn(price) => 
    Pos_count = 0 
    Neg_count = 0 
    min_distance = 10e10 
    nearest_index = 0 
    for j = 1 to 10 
        distance = math.sqrt(math.pow(price[j] - price, 2)) 
        if distance < min_distance 
            min_distance := distance
            nearest_index := j
            Neg = c[nearest_index] > o[nearest_index] 
            Pos = c[nearest_index] < o[nearest_index] 
            if Pos 
                Pos_count += 1
            if Neg 
                Neg_count += 1
    output = Pos_count>Neg_count?1:-1 

// Calls KNN function and smooths the prediction
knn_prediction_raw = knn(price) 
knn_prediction     = ta.wma(knn_prediction_raw, 3)
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Plots {
// Plots for display on the chart
knnMA_          = ta.wma(knnMA,5)
knnMA_col       = knnMA_>knnMA_[1]?Upknn_col:knnMA_<knnMA_[1]?Dnknn_col:Neuknn_col
Classifier_Line = plot(knnMA_,"Knn Classifier Line", knnMA_col)
MAknn_          = ta.rma(knnMA, smoothingPeriod)
plot(MAknn_,"Average Knn Classifier Line" ,Maknn_col) 
green = knn_prediction < 0.5
red   = knn_prediction > -0.5 
bgcolor( green and bgcolor? color.new(Dn_col,80) : 
 red and bgcolor ? color.new(Up_col,80) : na) 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

// ~~ Alerts {
knnMA_cross_Over_Ma      = ta.crossover(knnMA_,MAknn_)
knnMA_cross_Under_Ma     = ta.crossunder(knnMA_,MAknn_)
knnMA_cross_Over_Close   = ta.crossover(knnMA_,close)
knnMA_cross_Under_Close  = ta.crossunder(knnMA_,close)
knnMA_Switch_Up          = knnMA_[1]<knnMA_ and knnMA_[1]<=knnMA_[2]
knnMA_Switch_Dn          = knnMA_[1]>knnMA_ and knnMA_[1]>=knnMA_[2]
knnMA_Neutral            = knnMA_col==Neuknn_col and knnMA_col[1]!=Neuknn_col
greenBG                  = green and not green[1]
redBG                    = red and not red[1]

alertcondition(knnMA_cross_Over_Ma,  title = "Knn Crossover Average Knn",  message = "Knn Crossover Average Knn")
alertcondition(knnMA_cross_Under_Ma, title = "Knn Crossunder Average Knn", message = "Knn Crossunder Average Knn")
alertcondition(knnMA_cross_Over_Close,  title = "Knn Crossover Close",  message = "Knn Crossover Close")
alertcondition(knnMA_cross_Under_Close, title = "Knn Crossunder Close", message = "Knn Crossunder Close")
alertcondition(knnMA_Switch_Up,  title = "Knn Switch Up",  message = "Knn Switch Up")
alertcondition(knnMA_Switch_Dn, title = "Knn Switch Dn", message = "Knn Switch Dn")
alertcondition(knnMA_Neutral, title = "Knn is Neutral", message = "Knn is Neutral")
alertcondition(greenBG, title = "Positive Prediction", message = "Positive Prediction")
alertcondition(redBG, title = "Negative Prediction", message = "Negative Prediction")
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~}

Based AI Trend Navigator [K-Neighbor] created by Zeiierman in TradingView (TV)
https://www.tradingview.com/script/30aL ... -Neighbor/
Always looking the GREAT, never left GOOD Point...