ta.stderr
Measure how far a series scatters around its fitted trend line over the last n bars.
ta.stderr(source, length, min=length)Standard error of the regression: the ordinary least-squares line is fitted to the last length observations against bar position, and the result is the root of the sum of squared residuals divided by length - 2. length must be at least 3.
Parameters
A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.
| Name | Kind | Type | Default | Range | Description |
|---|---|---|---|---|---|
source | Series | number | - | - | The series to read. |
length | Constant | number | 20 | 3 to 10000 | Window in observed bars. |
min | Constant | number | - | 1 to 10000 | Valid values the window must hold before it reports (an option, written min=15). An na is skipped. Absent = length: the window must be full and gap-free. |
Output
| Name | Type |
|---|---|
value | number |
Warm-up and missing values
- Warm-up
lengthbars. Names in the warm-up are this operator’s parameters.- Missing values
- Returns na until
lengthconsecutive non-na observations are in the window. An na resets the accumulation. With min=, an na is skipped and the value is taken over the valid observations once there are at least min of them. The fit treats the valid observations as consecutive. It needs at least three of them.
Example
ta.stderr(close, 20)plot(ta.stderr(close, 20), "Standard error 20")