StandardDev (Function)
The StandardDev function calculates a standard deviation of values (population or sample).
Syntax
StandardDev(Price, Length, DataType)
Returns
A numeric value containing the current Standard Deviation.
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. |
DataType |
Numeric |
1 = population, 2 = sample |
Remarks
To derive the standard deviation, first find the variance and then take its square root:
StdDev =
…where
N is the number of elements
D is the individual elements in the sample
M is the sample mean
Example
Assigns to Value1 the sample type standard deviation Close over 21 bars.
Value1 = StandardDev(Close , 21, 2);