InertiaAll

InertiaAll ( IDataHolder data , int length , int startDate , int startTime , double extendToLeft , double extendToRight );

Default values:

length: all chart startDate: 0 startTime: 0 extendToLeft: No extendToRight: No

Description

Draws the linear regression function either for the entire plot or for the interval defined by the length parameter. If you specify length, the approximation is applied only for the last length bars of the plot, otherwise the approximation is applied for the entire plot and it is calculated based on all bars from the plot. See the Inertia function for more information.

The startDate (specified in the YYYYMMDD format) and startTime (specified in the HHMM format) define the date and time for the starting point of linear regression. These parameters override any value of the length if the startDate is non-zero.

By default, the function will return Double.NaN at any moment in time outside the interval used for calculation of linear regression. This behavior can be changed by using non-zero values of extendToLeft and extendToRight parameters.

Input parameters

Parameter Default value Description
data - Defines the variable for which the linear regression is calculated.
length all chart If specified, defines number of the last bars for which the curve is plotted, otherwise, the curve is plotted for the whole chart.
startDate 0 If specified, defines the date of starting point for calculation of linear regression, in the YYYYMMDD format.
startTime 0 If specified, defines the time of starting point for calculation of linear regression, in the YYYYMMDD format.
extendToLeft No Defines whether or not to extend the linear regression to the left of the end point.
extendToRight - Defines whether or not to extend the linear regression to the right of the end point.

Example

input length = 20;
plot MiddleLR = InertiaAll(close, length);

The example draws the linear regression for the close value for the defined number of last bars.