OPEN-SOURCE SCRIPT

Regression Curve with Normalized Angle

Theo cmthoman
Cập nhật
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.
Phát hành các Ghi chú
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.
Phát hành các Ghi chú
The default lookback period has been changed to 34.
Phát hành các Ghi chú
  • 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
Phát hành các Ghi chú
Unlocked the curve out styles to allow for additional customization.
OscillatorsTrend Analysis

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm