Standard deviation is a statistical term that measures volatility. The indicator uses the closing price to measure the dispersion of actual value from the average value. The wider the dispersion (difference between the actual value (e.g. closing price) and the average price (e.g. mean closing price)), the higher the standard deviation will be and the higher the volatility. The narrower the dispersion, the lower will be the standard deviation and the volatility.
Standard deviation is calculated based on the number of periods. The default value is 20 days, which represents the number of trading days in a month. To calculate a 20-period standard deviation:
- Take the mean closing price (i.e. average of the 20 closing prices).
- Get the difference of the actual closing price and the mean closing price for each period to get the deviation of each period,
- Square the deviation of each period.
- Get the sum of the squared deviations.
- Divide the sum of the squared deviations by the default value of 20.
- Take the square root of the quotient in #5 to get the standard deviation.