OPEN-SOURCE SCRIPT

Support and Resistance Polynomial Regressions | Flux Charts

Обновлено
Overview

This script is a dynamic form of support and resistance. Support and resistance plots areas where price commonly reverses its direction or “pivots”. A resistance line for instance is typically found by locating a price point where multiple high pivots occur. A high pivot is where a price increases for a number of bars then decreases for a number of bars creating a local maximum. This script takes the high pivots points but rather than using a horizontal line a polynomial regressed line is used.

It is common to see consecutive higher highs or lower lows or a mixed pattern of both so a classical support or resistance line can be insufficient. This script lets users find a polynomial of best fit for high pivots and low pivots creating a resistance and support line respectively.

Here are the same two sets of high and low pivots the first using linear regressed support and resistance lines the second using quadratic.
снимок
снимок

Here are the predicted results:
снимок
снимок

The Quadratic regression gives a much more accurate prediction of future pivot areas and the increase in variance of the data.

Quick Start

Add the script to the chart. Then select a left point and right point on the chart. This will be the data the script uses to calculate a best fit resistance line. Then select another left and right point that will be for the support line.

Now you can confirm your basic settings like the type of regression: Linear Regression, Quadratic Regression, Cubic Regression or Custom Regression.

After confirming the lines will be plotted on the graph.


Custom Polynomial Regression Setting
Polynomials follow the form:
снимок

The degree of a polynomial is the highest exponent in the equation. For example the polynomial ax^2 + bx + c has a degree of 2.

Here are the default polynomial options and their equivalent custom polynomial entry:

снимок

This allows us to create regressions with a custom number of inflection points. An inflection point is a point where the graph changes from concave up to concave down or vice versa. The maximum number of inflection points a polynomial can have is the degree - 2. Having multiple inflection points in our regression allows for having a closer fit minimizing error.

It should be noted that having a closer fit is not inherently better; this can cause overfitting. Overfitting is when a model is too closely fit to the training data and not generalizable to the population data.
Информация о релизе
Added a rolling calculation setting for support and resistance lines.
This allows users to have the data period update relative to the live bar. If a new data point enters the data period or the data period moves past an old data point the regression will recalculate.
Bands and Channelsforecastingregressions

Скрипт с открытым кодом

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

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


Access Flux Charts' exclusive indicators: FluxCharts.com/?via=tv

Join our FREE Discord for live trading sessions, signals, & trading resources: discord.gg/FluxCharts
Мои профили:

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