Hello,

I'm currently experimenting with a very simple pattern recognition. It takes n bars (or more exactly the value of the SMA, period 2 at each of these bars), calculates the difference between each of these values to the last bar in this group of n bars, then it normalizes this n-dimensional vector to length 1. It does this with all bars in the specified range, so it basically creates such a vector out of *every* bar with it's preceding n bars, so if n is 60 then it will make a vector out of bars 0..60, 1..61, 2..62 and so on.

It will then take the current pattern vector (the last n bars) and simply calculate the euclidean distance to every other vector (and to their inverse vectors to find mirror images) out of the history and plots the portion of the historical chart with the closest match in the indicator window.

Feel free to improve the code (I'm sure there could be some speed optimizations done), experiment with it, suggest better algorithms, earn big money with its "predictions" and buy me a beer once you have become rich ;-)

PS: The second indicator in the zip file will plot the second or third best match. It communicates with the first one via global variables, so the calculations must only be performed once.

I'm currently experimenting with a very simple pattern recognition. It takes n bars (or more exactly the value of the SMA, period 2 at each of these bars), calculates the difference between each of these values to the last bar in this group of n bars, then it normalizes this n-dimensional vector to length 1. It does this with all bars in the specified range, so it basically creates such a vector out of *every* bar with it's preceding n bars, so if n is 60 then it will make a vector out of bars 0..60, 1..61, 2..62 and so on.

It will then take the current pattern vector (the last n bars) and simply calculate the euclidean distance to every other vector (and to their inverse vectors to find mirror images) out of the history and plots the portion of the historical chart with the closest match in the indicator window.

Feel free to improve the code (I'm sure there could be some speed optimizations done), experiment with it, suggest better algorithms, earn big money with its "predictions" and buy me a beer once you have become rich ;-)

PS: The second indicator in the zip file will plot the second or third best match. It communicates with the first one via global variables, so the calculations must only be performed once.

Attached File

totalrecall_v1.0.zip 3 KB | 1,235 download