# Linear Regression Slope Histogram

This is the slope of linear regression plotted as a histogram. It has a threshold for the slope in case there is a minimum slope amount that the user wants for it to show green or red. The color shows a dim and bright effect depending on the direction of the slope to better show its rise and fall. You can set the length of the slope in the input setting screen.

Some interesting things about linear regression slope that I found out: It kind of looks like the histogram of ADX or the directional movement lines depending on the length used for the slope. According to Tushar Chande, linear regression can be used as an alternative of finding trend direction, although it is hard to say what length to use for it, I haven't been able to figure out a good way to apply it yet. According to Bulkowski, linear regression of the volume can be used with certain chart patterns that he listed to increase their chance of success by taking trades where the linear regression line points towards, so if you use volume as a source on this indicator you can take trades in whatever said direction. Got any other ideas on how to use linear regression? Feel free to let me knows, would gladly appreciate it.
Release Notes: Apparently the slope formula that a lot of people are using that I got off of on here might be wrong. It didn't match the results of what other platforms were showing. Instead of just simply finding rise over run, I think it might be better to just grab the slope portion of the linear regression equation and use that as the slope itself. I took from here alexgrover's linear regression formula and just did that. I think it's likely more accurate than trying to conjure up a made up rise over run that I was doing.

Re-ordered the color code

Tip: you can put in any source in and not just price. You can put in volume, RSI, or whatever indicator that is on display to find their slopes.
Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. You can favorite it to use it on a chart.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?