Programmatically compare two lines (pattern matching)

What I want to do is take a specific stock template (defined as a sequence of x and y coordinates) and compare it with historical stock prices. If I find anything at historical prices similar to the template I defined, I would like to return it as a coincidence.

I'm not sure how to determine how similar the two curved lines are. I did some research and you can find the similarities of the two straight lines (with linear regression), but I have not yet found a good way to compare the two curved lines.

My best approach right now is to get a few high and low points from the range of historical data I'm looking at, find the slopes of the lines and compare them with the slopes of the pattern that I am trying to match to see if they are about the same.

Any better ideas? I would love to hear them!

Edit: Thanks for entering! I used to think of the least squares approach, but I was not sure where to go. After the input I received, I think that by calculating the least squares of each row, we first smooth out the data a bit, then scale and stretch the template, as James suggested, should get me what I'm looking for.

I plan to use this to identify specific technical flags in the warehouse to identify buy and sell signals. There are already sites that do this to some extent (for example, exchange) , but, of course, I would like to try it myself and see if I can do better.

+3
source share
6 answers

, , , . - , , .

, - "" "" , , . x y. , , . , , , , , . , . .

0

, .

, (.8?), .

+1

, ( , , , , ..) .

. (, 0..1 ..), epsilon .

.

Mathworld (http://mathworld.wolfram.com/) .

0

, , ?

. ( , )

, , ?

0

The smallest squares would not be the best you could do on it. Use the RANSAC algorithm. It will process such data because such data is very unpredictable and often noisy.

0
source

All Articles