Past outcomes as predictions: Machine Learning for Automated Trading in Forex and Stocks p. 14

Thanks! Share it with your friends!

Using past outcomes as predictions from our pattern recognition.

Welcome to the Machine Learning for Forex and Stock analysis and algorithmic trading tutorial series. In this series, you will be taught how to apply machine learning and pattern recognition principles to the field of stocks and forex.

This is especially useful for people interested in quantitative analysis and algo or high frequency trading. Even if you are not, the series will still be of great use to anyone interested in learning about machine learning and automatic pattern recognition, through a hands-on tutorial series.

Sentdex.com

What machine learning algorithm is being used in this example? ( Supervised learning algorithm )

Alexandre Hubert says:

Hi Harrison,

I am still deeply studying your amazing series. I have veen struggling with your comparison between patForRec[29] and performanceAr[futurePoints] . I realized now that Tom had similar problem than me with the understanding. Would be amazing if you could drop few lines so things could be clearer in my mind. Thanks very much !

tom ramone says:

Harrison, please help my understanding. Where you check if predictions were good and color code red or green in following line:  if performanceAr[futurePoints] > patForRec[29]:       ok, my thinking is patForRec[29] is basically the most current return over last 30 intervals and performanceAr[futurePoints] is a return over avgLine[y+20:y+30]  (some 10 intervals) . Why compare these two returns to each other. I'm thinking we want to know if certain pattern leads to returns, but it looks like you check if last 30 intervals of data set has better returns than some other interval in data set.  please help my understanding. Thanks!!

Andrea Zanchetta says:

Thanks for your G R E A T tutorials that are helping me so much in learning to code in Python and have fun!
Your explanations are extremely clear. Rare talent!
I was reviewing the code and I think this line:
if performanceAr[futurePoints]> patForRec[29]:
should be changed into this one:
if performanceAr[futurePoints]> 0:
I think it should be so as  perfromanceAr is the array of percent changes from the last data of the "historical pattern" to the average of the future ten points considered in calculating the performance.
So it gives already the performance of the "historical pattern" which has been classified as similar to the present pattern.
The original code line seems comparing the future performance of the "historical pattern" with the percent change of the present pattern from the beginning till the end of it..
Please let me know whether I am missing something.
Thanks so much Mr. Sentdex and Happy New Year from Hong Kong!