AvgDeviation (Function)
The AvgDeviation function is an Average of the absolute value of the difference of each data point from the mean and dividing the sum by the number of elements.
Syntax
AvgDeviation(Price,Length)
Returns (Double)
A positive numeric of the average deviation for the current bar.
Parameters
|
Name |
Type |
Description |
|
Price |
Numeric |
Specifies which bar value (price, function, or formula) to be considered. |
|
Length |
Numeric |
Sets the number of bars to be considered. |
Remarks
AvgDeviation is a measure of the variability in a data set.
The AvgDeviation function first calculates a standard average (mean) of the Price input parameter using the Length input parameter for the number of trailing bars. It then measures the absolute difference (ABSValue, which removes the negative sign) of the Price input parameter from the mean for each data point and then averages the sum of the differences.
The input parameter Price can be a bar value such as Close, High, Low, Open, or Volume. It can also be any mathematical calculation such as High + Low) / 2, or a numeric function such as RSI, Stochastic, or ADX.
The value for the Length input parameter should always be a whole number greater than 0.
Example
Assigns the 9 bar average deviation of the Close from the mean to Value1, then plots Value1:
Value1 = AvgDeviation (Close,9);
Plot1(Value1, "AvgDev");