OPEN-SOURCE SCRIPT

Support and Resistance Polynomial Regressions | Flux Charts

Cập nhật
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.
ảnh chụp nhanh
ảnh chụp nhanh

Here are the predicted results:
ảnh chụp nhanh
ảnh chụp nhanh

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:
ảnh chụp nhanh

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:

ảnh chụp nhanh

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.
Phát hành các Ghi chú
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

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 đồ?


Get Access to Flux Charts indicators: fluxcharts.com/?via=tv

Free trade signals for stocks, crypto, forex, and futures: discord.gg/fluxcharts
Ngoài ra, trên:

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