Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify breakpoints (trend lines edges) in a dataset?

I've been performing some research, in order to find the best approach to identify break points (trend direction change) in a dataset (with pairs of x/y coordinates), that allow me to identify the trend lines behind my data collections.

However I had no luck, finding anything that brings me some light.

The yellow dots in the following image, represent the breakpoints I need to detect.

Any suggestion about an article, algorithm, or implementation example (typescript prefered) would be very helpful and appreciated.

breakpoints-and-trend-lines

like image 609
colxi Avatar asked Jun 07 '20 17:06

colxi


People also ask

How do you find the break point of data?

The breakpoint is the lower value of the range that entitles a customer to a discount. For example, if you offer a one dollar discount per unit for each order between 200 and 299 units, the breakpoint is 200 units.

What is breakpoint analysis?

Break point analysis is a way of looking at customer satisfaction data to determine when there are shifts or breaks in satisfaction levels.


1 Answers

Usually, people tend to filter the data by looking only maximums (support) or only minimums (resistance). A trend line could be the average of those. The breakpoints are when the data crosses the trend, but this gives a lot of false breakpoints. Because images are better than words, you can look at page 2 of http://www.meacse.org/ijcar/archives/128.pdf.

There are a lot of scripts available look for "ZigZag" in

https://www.tradingview.com/

e.g. https://www.tradingview.com/script/lj8djt1n-ZigZag/ https://www.tradingview.com/script/prH14cfo-Trend-Direction-Helper-ZigZag-and-S-R-and-HH-LL-labels/

Also you can find an interesting blog post here (but code in in python):

https://towardsdatascience.com/programmatic-identification-of-support-resistance-trend-lines-with-python-d797a4a90530

with code available: https://pypi.org/project/trendln/

like image 91
One Lyner Avatar answered Oct 25 '22 13:10

One Lyner