StErrAll

StErrAll ( double extendToRight);

Default values:

extendToRight: No

Description

Returns the standard error of data around the regression line for the entire plot or for the interval of last bars defined by the length parameter. The difference of thIS function from StErr is that the output result for the last bar is used for the whole interval calculated.

If the length parameter is not specified, the function is calculated for the entire plot.

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 standard error 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 standard error, in the YYYYMMDD format.
startTime 0 If specified, defines the time of starting point for calculation of standard error, in the YYYYMMDD format.
extendToLeft No Defines whether or not to extend the standard error curve to the left of the end point.
extendToRight No Defines whether or not to extend the standard error curve to the right of the end point.

Example

input price = close;

def regression = InertiaAll(price);
def stdError = StErrAll(price);

plot UpperLine = regression + stdError;
plot LowerLine = regression - stdError;

The example draws the Standard Error Channel which is the linear regression channel spaced by a standard error. The error channel is based on the price data for the last 30 bars.