# Trend line not from scratch, Correlations, Trend Lines, and Formulas in Tableau

Well since this article is named Algorithmically drawing Trend Lines on a Stock Chart, you might already have guessed the answer ;- Buys a put option whether these lines are useful or not is a whole different topic. On the other hand, people are using these lines so there should also be some kind of self-fulfilling prophecy component with them.

### Trendline Not Appearing in new version of Excel (2007)

However, the secret ingredient is called Hough Transform. The idea of the Hough transformation is, that every edge point in the edge map is transformed into all possible lines that could pass through that point.

The areas where most Hough space lines intersect is interpreted as true lines. It is not that complicated as it sounds. You need to know that Hough transformation is mostly used in image processing i.

Therefore you need to pre-process images using an edge detector. Well, of course, we use a discrete amount of lines where the number is somewhat arbitrary. You can obviously find lots of tutorials and explanations of the Hough transformation on the internet if you want to dive deeper.

Or you just take a look at this guy who tries to explain it for us. Implement a Hough Transform for a trend line not from scratch price chart The fully functional code and a Jupyter notebook can be found as part of a bigger library I am working on in my GitHub repository [2]. And just for visibility we only look at the most recent days.

Use the standard approach and rescale all prices to fall between 0 and 1 and round these numbers just to remove a bit of noise.

But since we have stock prices and not an image we use a slightly different approach. For the x-axis, we introduce a linear space from 0 to 1 and for the y-axis, we use the rescaled prices.

At this point, all you have to do is drag your Pearson R calculation into the tooltip, do a bit of formatting, and voila, you can now hover over any point and see the Pearson R correlation for the variables in the view: In my Indices of Deprivation viz, I also included information to demonstrate how far each point is from the trend line, which you can see in the tooltip as well as the colour legend. If you wanted to use it in a calculated field e. What you have to do is essentially construct the trend line from scratch using calculations that will ultimately comprise the formula for a line.

For our use case of finding trend lines we need to detect turning points. There we calculate the mean and check if the first and the latest data points are both above or below the mean.

- You can publish a view that contains trend lines, and you add trend lines to a view as you edit it on the web.
- Trendline Not Appearing in new version of Excel () - Microsoft Community