OPEN-SOURCE SCRIPT

Regression Curve with Normalized Angle

由cmthoman提供
已更新
Regression Curve with Normalized Angle plots the Linear Regression Curve and the Pearson correlation coefficient to allow a visualized direct comparison of the two over a user defined lookback period. The Pearson correlation coefficient can be used to identify trend without the need to chart the Linear Regression line. As seen in the Crude Chart, Linear Regression angle alone cannot always be used to determine trend. Included are Long and Short threshold lines that can be used to define at what angle a Long or Short trend begins.
發布通知
User Experience Updates:

Since some traders have shown interest in this, I'm creating an update that improves readability. Below is also a better description of my interpretation for using the indicator for trend analysis.

  • Color coded the Pearson Correlation Line
  • Changed the Regression Curve to a histogram
  • Changed the color of the top and bottom dashed lines of the trend thresholds
  • Code cleanup


My interpretation on trend direction and strength:

The red and green line is Pearson's Correlation Coefficient for the instrument price over time as converted to an angle. It will normalize between 45 and -45 degrees. If it is above 38 or below -38 the trend is considered strong (long or short).

The first time this line crosses into the 38 to 45 degree range the color will change to green for uptrends. The same is true between -38 and -45 degrees for downtrends, the color now changes to red. When the line exits one of these ranges the color will reverse giving you an indication that trend strength (correlation) is weakening and a potential price reversal is being forecasted.

The histogram shows the linear regression curve. Combined with the threshold markers, it provides an at a glance picture of how the trend direction (long, short or none). The correlation line can be used to help confirm the trend direction and strength as the linear regression curve changes.
發布通知
The default lookback period has been changed to 34.
發布通知
  • Added parameter options to customize thresholds
  • Added strong long and short correlation zone fills to more clearly depict when the correlation is high
  • Added additional color customization options
  • Rounded the outputs to whole numbers to avoid discrepancies with the 'Precision' style settings
發布通知
Unlocked the curve out styles to allow for additional customization.
OscillatorsTrend Analysis

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明