Moving Standard Deviation

ICE Data Services -

stdDev() Built-in Study Functions

The Moving Standard Deviation study measures the market volatility. This study charactrizes the scale of price changes relating to the Moving Average. Thus, if the study value is large, the market is volatile and the bars prices are rather dispersed relating to the moving average. If the study value is not large, it means that the market volatility is low and the bars prices are rather close to the moving average.

Syntax
stdDev( nLength [, Series | sym() | inv() ][, nBarIndex ] )

Parameters
Parameter: Description: Default:
nLength Required. Number of periods to use for calculation.

 

n/a Series or
sym() or
inv()
[Optional]  Series Object or function of sym() or inv() to determine symbol/interval source for the study.

 

Base sym/inv nBarIndex [Optional]  Bar index of series to retrieve.

 

n/a


Return Value(s)

Returns a Series Object when nBarIndex is not specified.

Returns a single value when nBarIndex is specified.


Notes
Only available in versions 12.1 or later.

Code Examples
Single Line Indicator:
function main() {    return stdDev(14);}

Single Line Study-on-Study Indicator:
function main() {    return stdDev(14, hl2());}

Retrieve single values:
function main() {    var nValue_0 = stdDev(14, 0);  // Current Bar Index    var nValue_1 = stdDev(14, -1); // Prior Bar Index             return new Array(nValue_0, nValue_1);}

Initialize a Series Object:
var xStudy = null;function main() {    if (xStudy == null) {        xStudy = stdDev(14);    }            // retrieve single values for conditional statements    var nValue_0 = xStudy.getValue(0);  // Current Bar Index value    var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value            return nValue_0;  // Plot Current Bar Index Value}

Initialize a Series Object based on an external interval:
var xStudy = null;var bInit = false;  // Initialization flagfunction main() {    if (bInit == false) {        xStudy = stdDev(14, inv(20));  // 20-min interval        bInit = true;    }            // retrieve single values for conditional statements    var nValue_0 = xStudy.getValue(0);  // Current Bar Index value    var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value            return getSeries(xStudy);  // Synchronized Series plot}


Initialize a Series Object based on an external symbol and interval:
var xStudy = null;var bInit = false;  // Initialization flagfunction main() {    if (bInit == false) {        xStudy = stdDev(14, sym("IBM,20"));  // IBM 20-min interval        bInit = true;    }         // retrieve single values for conditional statements    var nValue_0 = xStudy.getValue(0);  // Current Bar Index value    var nValue_1 = xStudy.getValue(-1); // Prior Bar Index value         return getSeries(xStudy);  // Synchronized Series plot}


See Also
Series Object
getSeries()
Built-in Study Functions
eSignal Forum Search Engine
Help Guides
Tutorials