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 автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?

Отказ от ответственности