Polynomial Predict

Top  Previous  Next

Category: Advanced Indicator Set 1

 

Input parameters

Name

Setting

Default

Input series

Input Time Series

Close

Polynomial degree

0<= Integer <=100

2

Number of points

Integer >=1

20

Predict period

Integer >=0

1

 

Calculations

For the current bar the Polynomial Predict indicator calculates a polynomial p(t) through the most recent Number of points in the form:

p(t) = a0 + a1 * x(t) + a2 * x(t)^2 + … + aN * x(t) ^ N,

where a0..aN - polynomial coefficients, x(t) - X-coordinate value, and N - Polynomial Degree.

The goal of the polynomial regression is to find a set of coefficients a0, a1, …, aN, which minimize the error function Sum(y(t)-p(t))^2.

After polynomial coefficients are found, the indicator calculates a projected value for the Predict period into the future. The predicted value is drawn as a signal on the current bar.

For example, given default settings, the Polynomial Predict indicator takes the most recent 20 bars (including the current bar), draws a polynomial of second degree, computes a projected polynomial value for the next bar, and shows that projected value on the current bar.