RegressionValue

Top  Previous  Next

Finds the value of a linear regression of the series at any point using an offset. Note that this function must be used in conjunction with RegressionSlope. This function merely returns the slope  and endpoint already calculated by RegressionSlope, so this function must follow RegressionSlope to return the correct value. The series is a required input parameter and an offset.

 

Syntax

 

RegressionValue( series, offset )

 

Parameters

series

 

the name of the series

offset

 

the number of bars back

 

 

 

returns

 

the value at the offset

 

Example

' Find the slope of the linear regression of the last 10 closes.

slope = RegressionSlope( instrument.close, 10 )

 

' Plot the linear regression on the bars that have been used to calculate it. This is postdictive.

' The variable plotRegression is declared as an Instrument Permanent Auto Index Series Variable with plotting.

       

       FOR i = 0 to 9

               plotRegression[i] = RegressionValue( instrument.close, i )

       NEXT

 

 

 

 

This example shows the use of the common auto indexed series. For information on using functions with non auto indexed series review Series Functions.