OPEN-SOURCE SCRIPT

Support and Resistance Polynomial Regressions | Flux Charts

Telah dikemas kini
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.
syot kilat
syot kilat

Here are the predicted results:
syot kilat
syot kilat

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:
syot kilat

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:

syot kilat

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.
Nota Keluaran
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

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?


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

Join our FREE Discord for live trading sessions, signals, & trading resources: discord.gg/FluxCharts
Juga pada:

Penafian