ta.dev() - Pine Script Function
ta.dev()
Section titled “ta.dev()”Overview
Section titled “Overview”Measure of difference between the series and it’s ta.sma
Syntax
Section titled “Syntax”ta.dev(source, length) → series floatParameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| source | series int/float | Series of values to process. |
Returns
Section titled “Returns”Deviation of source for length bars back.
Remarks
Section titled “Remarks”- na values in the source series are ignored.
Examples
Section titled “Examples”Example 1
Section titled “Example 1”//@version=6indicator("ta.dev")plot(ta.dev(close, 10))// the same on pinepine_dev(source, length) => mean = ta.sma(source, length) sum = 0.0for i = 0 to length - 1 val = source[i] sum := sum +math.abs(val - mean) dev = sum/lengthplot(pine_dev(close, 10))