LinearRegValueFC (Function)
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 LinearRegValue function projects, based on the current regression line, the regression values for x number of bars out into the future or x number of bars back in the past.
Function
LinearRegValueFC(Price, Length, TgtBar)
Parameters
|
Name |
Type |
Description |
|
Price |
Numeric |
Specifies the value of interest is to be used. |
|
Length |
Numeric |
Specifies the number of bars to consider in the regression calculation. |
|
TgtBar |
Numeric |
Represents the number of bars into the future or back into the past, zero for the current bar. Use a negative integer for a future bar, a positive integer for a previous bar, and zero for the current bar. |
Returns
A numeric value containing the current value of the specified regression line at TgtBar.
Usage
The input Price can be hard coded with a bar attribute such as Close, Open, High, Low, and Volume or a numeric series type input. It can also be replaced with a valid EasyLanguage expression. For example: Close + Open, or Average(RSI(Close,14),14).
The input Length can be hard coded replaced with a numeric simple type input.
TgtBar represents the number of bars into the future or back into the past. If TgtBar is a positive number, LinearRegValue will be for a bar in the past. If TgtBar is negative, the LinearRegValue will be for a bar in the future. TgtBar can be replaced with a numeric simple input.
This function uses a fast calculation method that uses more memory than the traditional method.