TradingView
capissimo
Feb 19, 2021 5:27 AM

Machine Learning: kNN-based Strategy (update) 

Euro Fx/U.S. DollarFXCM

Description

kNN-based Strategy (FX and Crypto)

Description:

This update to the popular kNN-based strategy features:
improvements in the business logic,
an adjustible k value for the kNN model,
one more feature (MOM),
a streamlined signal filter and
some other minor fixes.

Now this script works in all timeframes !

I intentionally decided to publish this script separately
in order for the users to see the differences.

Release Notes

Major fix: added scaling function for the mom feature. Mom requires scaling to the range of [0,...,100].
Comments
bluiska
Why is this not drawing the last few indicators? For me, it seems to not draw the indicators in realtime, as if it cuts off the last few predictions.
JokingPips
@bluiska, i second this. @capissimo do we need to wait for a few close candles for it to calculate or is there something wrong?
PSSTRADING
First of all thanks for that great script and the awesome content you are producing for this community!

I would like to ask if this updated version is still repainting?
capissimo
@walfgott, unfortunately, yes. Hopefully, this community will find the proper way.
mohammadajo
@capissimo, Why is this not drawing the last few indicators?
Would you please help.

Thanks.
gmeneguzzo
does exist a solution to avoid repainting for this study ?
Minimal_Est
Perhaps you should turn it into a strategy and wait for the signal to be triggered on the bar close after the signal condition has been met. On the exits then you could use a strategy.exit to exit in that precise moment instead. but these are just my 2cents.
capissimo
@Minimal_Est, I prefer not to and leave it to the users. You propose to use a black box magic.
Minimal_Est
@capissimo, black box magic ?
capissimo
@Minimal_Est, en.wikipedia.org/wiki/Black_box
More