<P> Calculating the average (or arithmetic mean) of the return of a security over a given period will generate the expected return of the asset . For each period, subtracting the expected return from the actual return results in the difference from the mean . Squaring the difference in each period and taking the average gives the overall variance of the return of the asset . The larger the variance, the greater risk the security carries . Finding the square root of this variance will give the standard deviation of the investment tool in question . </P> <P> Population standard deviation is used to set the width of Bollinger Bands, a widely adopted technical analysis tool . For example, the upper Bollinger Band is given as x + nσ . The most commonly used value for n is 2; there is about a five percent chance of going outside, assuming a normal distribution of returns . </P> <P> Financial time series are known to be non-stationary series, whereas the statistical calculations above, such as standard deviation, apply only to stationary series . To apply the above statistical tools to non-stationary series, the series first must be transformed to a stationary series, enabling use of statistical tools that now have a valid basis from which to work . </P> <P> To gain some geometric insights and clarification, we will start with a population of three values, x, x, x . This defines a point P = (x, x, x) in R. Consider the line L = ((r, r, r): r ∈ R). This is the "main diagonal" going through the origin . If our three given values were all equal, then the standard deviation would be zero and P would lie on L. So it is not unreasonable to assume that the standard deviation is related to the distance of P to L. That is indeed the case . To move orthogonally from L to the point P, one begins at the point: </P>

Where does the standard deviation formula come from