Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 89237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:41:06+00:00 2026-05-10T22:41:06+00:00

What I want to do is take a certain stock pattern (defined as a

  • 0

What I want to do is take a certain stock pattern (defined as a series of x and y coordinates) and compare it against historical stock prices. If I find anything in the historical prices similar to that pattern I defined, I would like to return it as a match.

I’m not sure how to determine how similar two curved lines are. I did some research, and you can find the similarity of two straight lines (with linear regression), but I haven’t yet come across a good way to compare two curved lines.

My best approach right now is get several high and low points from the historical data range I’m looking at, find the slopes of the lines, and compare those to the slopes of the pattern I’m trying to match to see if they’re roughly the same.

Any better ideas? I’d love to hear them!

Edit: Thanks for the input! I considered the least squares approach before, but I wasn’t sure where to go with it. After the input I received though, I think computing the least squares of each line first to smooth out the data a little bit, then scaling and stretching the pattern like James suggested should get me what I’m looking for.

I plan on using this to identify certain technical flags in the stock to determine buy and sell signals. There are already sites out there that do this to some degree (such as stockfetcher), but of course I’d like to try it myself and see if I can do any better.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:41:07+00:00Added an answer on May 10, 2026 at 10:41 pm

    One of the problems is that curve fitting using non-linear functions is not always going to work for some of your patterns depending how complex they are. You could use quadratic or cubic or some other order of polynomials to get a more accurate result but it’s not going to work in all situations, particularly with any sharp changes in the data over time.

    Honestly I think a reasonable and relatively simple solution is to ‘scale’ and ‘stretch’ your pattern so that it occurs over the same range as the historical data. You can use interpolation for the x axis and multiplication plus an offset for the y-axis. After that just look at the mean of the squared differences at each point and if that is lower than a threshold value then you can consider it a match. It will require a bit of tweaking to achieve predictable results but I think it’s a nice approach that should allow you to define any sort of pattern without relying on regression producing a nicely fitted curve. Essentially it’s just an application of statistics. You could also look at standard deviations or variance for a more comprehensive approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to take in a certain format of one text file. After the
I Want to execute a Certain Task to take only 1000 MS , if
I have a very basic question i want to take integer input in certain
I want to take a look at the implementation of a certain IL instruction,
I want to take html, including the text and images and turn it into
I want to take the value stored in a 32 bit unsigned int, put
We want to take XML data and convert it to an NSDictionary object, but
I want to take a floating point number in C++, like 2.25125, and a
I want to take a snapshot of a view (WebView) or, if that is
I want to take a file from disk and upload it into an Oracle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.