TradingView
Julien_Eche
11 мая 2023 г., 06:26

Advanced Trend Channel Detection (Log Scale) 

Tesla, Inc.NASDAQ

Описание

The Advanced Trend Channel Detection (Log Scale) indicator is designed to identify the strongest trend channels using logarithmic scaling. It does this by calculating the highest Pearson's R value among all length inputs and then determining which length input to use for the selected slope, average, and intercept. The script then draws the upper and lower deviation lines on the chart based on the selected slope, average, and intercept, and optionally displays the Pearson's R value.

To use this indicator, you will need to switch to logarithmic scale. There are several advantages to using logarithmic scale over regular scale. Firstly, logarithmic scale provides a better visualization of data that spans multiple orders of magnitude by compressing large ranges of values into a smaller space. Secondly, logarithmic scale can help to minimize the impact of outliers, making it easier to identify patterns and trends in the data. Finally, logarithmic scale is often utilized in scientific contexts as it can reveal relationships between variables that may not be visible on a linear scale.

If the trend channel does not appear on the chart, it may be necessary to scroll back to view historical data. The indicator uses past price data to calculate the trend channel, so if there is not enough historical data visible on the chart, the indicator may not be able to identify the trend channel. In this case, the user should adjust the chart's timeframe or zoom out to view more historical data. Additionally, the indicator may need to be recalibrated if there is a significant shift in market conditions or if the selected length input is no longer appropriate.

Информация о релизе

Correction on display of length names
Комментарии
Urbanmove
Hey! Great script, and awesome approach deciding the best fitting trend via correlation! I was going through its implementation and started studying the implementation of the calcSlope(source, length) function... I BELIEVE its formulation differs from the one in this link: en.wikipedia.org/wiki/Simple_linear_regression --- Specifically, the computation of the y-intercept... according to the aforementioned link, intercept = y_average - slope*x_average. BUT the formulation of the calcSlope function is: intercept = average - slope * sumX / length + slope, which is logically equivalent to stating: intercept = average - slope*x_average... + slope again... why is this adding the slope again? Am I missing something? Thanks!
Urbanmove
Interestingly enough... including "+ slope" yields a regression line that matches TV's trend channel tool... excluding this addition, yields a line that does NOT macthes TV's trend channel tool.
Ещё