Next: , Previous: , Up: Common Calculations   [Index]

### 11.2 Standard Deviation

Standard deviation (stddev) is a statistical measure of how much the values in a data set deviate from their average (mean). The stddev of a past N days is used in the calculation of Bollinger bands (see Bollinger Bands) and VIDYA and Variable Index Dynamic Average).

The raw stddev values can be shown in Chart as an indicator, to see what goes into those calculations. The values have little direct use though, and for that reason stddev is under “Low Priority” in the indicator lists.

For reference, the formula on prices p1 to pN is as follows. Each p[i]-m is the distance from the mean m, and those distances are averaged with a quadratic mean.

```               / (p1-m)^2 + (p2-m)^2 + ... + (pN-m)^2 \
Stddev = sqrt (  ------------------------------------  )
\                   N                  /
```

where m is the arithmetic mean

```    p1 + p2 + ... + pN
m = ------------------
N
```

Also, for reference, the formula can be rearranged to the following form, “sum of the squares minus square of the sums”. This is what Chart uses, because a new term can be shifted into the sums without recalculating all N terms.

```               / p1^2 + p2^2 + ... + pN^2   (p1 + p2 + ... + pN)^2 \
Stddev = sqrt (  ------------------------ - ----------------------  )
\            N                         N^2          /
```

Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2014, 2015, 2016, 2017 Kevin Ryde

Chart is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.