24135 просмотров
This is an experimental study which calculates a linear regression channel over a specified period or interval using custom moving average types for its calculations.

Linear regression is a linear approach to modeling the relationship between a dependent variable and one or more independent variables.
In linear regression , the relationships are modeled using linear predictor functions whose unknown model parameters are estimated from the data.

The regression channel in this study is modeled using the least squares approach with four base average types to choose from:
-> Arnaud Legoux Moving Average ( ALMA )
-> Exponential Moving Average ( EMA )
-> Simple Moving Average ( SMA )
-> Volume Weighted Moving Average ( VWMA )
When using VWMA , if no volume is present, the calculation will automatically switch to tick volume , making it compatible with any cryptocurrency, stock, currency pair, or index you want to analyze.

There are two window types for calculation in this script as well:
-> Continuous, which generates a regression model over a fixed number of bars continuously.
-> Interval, which generates a regression model that only moves its starting point when a new interval starts. The number of bars for calculation cumulatively increases until the end of the interval.

The channel is generated by calculating standard deviation multiplied by the channel width coefficient, adding it to and subtracting it from the regression line, then dividing it into quartiles.

To observe the path of the regression, I've included a tracer line, which follows the current point of the regression line. This is also referred to as a Least Squares Moving Average ( LSMA ).

For added predictive capability, there is an option to extend the channel lines into the future.

A custom bar color scheme based on channel direction and price proximity to the current regression value is included.

I don't necessarily recommend using this tool as a standalone, but rather as a supplement to your analysis systems.
Regression analysis is far from an exact science. However, with the right combination of tools and strategies in place, it can greatly enhance your analysis and trading.
-> Script structure has been reorganized.
-> Corrected NaN filter values in initial states.
-> Added Rolling Moving Average and Linear Weighted Moving Average to the list of available base averages.
-> Added style customization for the channel lines. Because TV doesn't have built-in style inputs for line objects, you'll find these settings in the "Inputs" section. For each channel line, you can now adjust:
- If the line is drawn - selected via the specified toggle switch
- Width of the line - can be any integer greater than zero
- Style of the line - available styles are solid, dotted, and dashed
- Color of the line - uses my RGB color editor, which has 216 colors to choose from via the specified R, G, and B inputs

For my full list of premium tools, check the blog:
https://wallanalytics.com/

Reach out on Telegram:
https://t.me/DonovanWall
Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?
{"ft_lang_label":"__label__en","ft_lang_prob":0.7642436,"math_prob":0.8639669,"size":6315,"snap":"2021-43-2021-49","text_gpt3_token_len":1328,"char_repetition_ratio":0.12311836,"word_repetition_ratio":0.8810916,"special_character_ratio":0.19904988,"punctuation_ratio":0.10502283,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97208863,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-12-08T11:56:57Z\",\"WARC-Record-ID\":\"<urn:uuid:7f145dbe-e4bc-4759-a5db-7e5fd29f365c>\",\"Content-Length\":\"277594\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:99137e0f-108f-4bfb-811b-74536d0ba355>\",\"WARC-Concurrent-To\":\"<urn:uuid:4b022998-9e35-46fd-9325-81ca7d8ea804>\",\"WARC-IP-Address\":\"52.85.131.91\",\"WARC-Target-URI\":\"https://ru.tradingview.com/script/xnMdv0lA-Regression-Channel-DW/\",\"WARC-Payload-Digest\":\"sha1:BGT5LKUI4L3THBRLG5WLU2YB72F76GQJ\",\"WARC-Block-Digest\":\"sha1:BTXGXPQGKHAANWFKDHGVZQUL7YSNWYZQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-49/CC-MAIN-2021-49_segments_1637964363510.40_warc_CC-MAIN-20211208114112-20211208144112-00004.warc.gz\"}"}