Returns the mean absolute deviation of source over length bars: the average distance of each value from the window's mean.
ta.dev finds the simple average of the window, then averages the absolute distance of every value from it. Unlike ta.stdev, distances are not squared, so outliers count less.
The window must be full and free of na for a value to appear.
Syntax
ta.dev(source: series int/float, length: series int) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| source | series int/ | required | The series whose mean absolute distance from its own mean is measured over length bars. |
| length | series int | required | Number of bars in the window. A whole number of 1 or more. |
Returns
series float: the mean absolute deviation in the units of source.
Remarks
ta.ccidivides by 0.015 times this value.
Example
//@version=6
indicator("Mean deviation")
plot(ta.dev(close, 20), "Mean abs deviation", color = color.teal)
plot(ta.stdev(close, 20), "Stdev", color = color.gray)See also
Runs on Sidechair