Download MetaTrader 5
To add comments, please log in or register
Documentation is available in CHM and PDF. Download it in any convenient form!
Automated-Trading
Admin
88682
Automated-Trading 2010.07.09 10:29 

Price prediction by Nearest Neighbor:

This indicator uses the Nearest Neighbor clustering technique, also called k-NN, to search for the most similar pattern in history and use its past prices as predictions of the current pattern future prices.

The present indicator finds only one nearest neighbor. So, in essence, it is a 1-NN algorithm. It uses the Pearson correlation coefficient between the current pattern and all past patterns as the measure of distance between them.

The indicator plots two curves: the blue curve indicates the past prices of the nearest neighbour and the red curve indicates the future prices of the same pattern. The nearest neighbour is scaled according to the linear regression slope between this pattern and the current pattern. The indicator also prints the information about the starting date of the nearest neighbor and its correlation coefficient to the present pattern.

Author: Vladimir

Price prediction by Nearest Neighbour

q_import
826
q_import 2010.07.11 13:10  
Very Nice
Vladimir
5837
Vladimir 2010.07.11 18:37  

q_import:
Very Nice

 

Thanks.

johnmcgiles
33
johnmcgiles 2010.11.14 03:34  

I can't add comments to your most recent nearest neighbor post so I'm going to ask a question in this one.  First off, thank you for submitting this, I find it very interesting, but how do you get the future indicator values using this?  I'm using the code below to get the indicator's prediction 50 bars in the future, but this is just an intuitive guess as to how it should work, is this right?   

int nearestNeighborHandle = iCustom(_Symbol,_Period,"nearest_neighbor_-_weighted_corr",300,50);

double  indicatorValues[];

if( CopyBuffer(nearestNeighborHandle,0,-50,50,indicatorValues) < 0 )  {} 

 

Thank you. 

dee544
118
dee544 2011.03.27 18:50  

 

many thanks for your interesting indicator.
If I use your indicator in a strategy, I get the following output:

I suspe
ct that the calculation nearst neighbor with the number of bars starts. Is that correct?

Regards

dee544  

 

MathQuant
73
MathQuant 2013.01.20 16:09  

Thank You


Hooshang Nosratpanah
62676
Hooshang Nosratpanah 2013.07.05 02:02  
Great
Kevin Manrrique
195
Kevin Manrrique 2016.04.01 03:14  
Is this version also available for MT4?
/
To add comments, please log in or register