Machine Learning: kNN-based Strategy (mtf)

This is a multi-timeframe version of the kNN-based strategy.
Release Notes: Added custom performance testing.
Release Notes: Updated signal filtering, added data normalization plus some minor fixes.
Release Notes: Price fix in the custom performance testing module.
Release Notes: Minor fix.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


how do you change this to a strategy so we can backtest it on the charts?
+7 Reply
that was quick luv u bro
+2 Reply
hello, new to this.. can you show results of backtesting? or how to "edit it" to get the result?
+1 Reply
is there any progress about repainting?
Teach Me Please
Thanks @capissimo . for powerful and strong signals using Hyperbolic Tangent function and Overbought , Oversold levels.
Hi @capissimo, does it repaint? I remember you confirmed it did but I am not sure if it does it anymore.
capissimo dipiers
@dipiers, you should understande the main principle of the algo: it collects data points and selects the ones that are the closest to the current bar's close price. Thus, it repaints. Repainting is yet to be solved. Hopefully, the local community would help.)
+1 Reply
I really like the backtest results you can see in the study. Could be useful for calculating optimal settings based on profit for each setting.

I also tried turning this into a strategy but the results dont come back as amazing as they look on chart backtest. Should the trades be made as soon as there is a signal or do we still wait for the bar to close? If the close then not sure why the tradingview strategy backtest is so different.
capissimo OrionAlgo
@OrionAlgo, i have the same questions regarding TV backtesting results, so I devised my own empirical calculation as a uniform criteria to compare different strats. Apart from ML-based ones, I use several more indicators to decide about entering a trade.
+1 Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter