TimeSeriesForecast (Function)
The TimeSeriesForecast function returns the value where a linear regression line of the Close is projected to be relative to a future (or past) bar position.
Syntax
TimeSeriesForecast(Length, TgtBar)
Returns (Double )
A numeric value of a future (or past) bar position.
Parameters
|
Name |
Type |
Description |
|
Length |
Numeric |
Sets the bars to consider. |
|
TgtBar |
Numeric |
Sets the point in the past or future to use for projecting a regression value. Use a positive integer for a previous point and a negative integer for a future point. |
Remarks
Linear Regression is a concept also known as the "least squares method" or "best fit." Linear Regression attempts to fit a straight line between several data points in such a way that distance between each data point and the line is minimized.
The equation of any line resembles the following:
y = mx + b
In the equation m refers to the slope of the regression line, b refers to the constant intercept of the y-axis, x is the independent variable, and y is the dependent variable. This function returns all values.
Example
Assigns to Value1 the projected value 5 bars in the future of a linear regression line over the past 20 bars.
Value1 = TimeSeriesForecast (20, -5);
Reference
Linear Regression is a principle found in most statistical publications.