# Standard Deviation Indicator

Standard distribution is the basis that every other pattern of random distribution gravitates to over time, but even those with heavy or long tales, multimodality (such as those with multiple regional means, or medians) eventually converge on the standard distribution pattern as the number of samples is increased. As such, it is the basis of any kind of introduction to statistical analysis. The standard deviation indicator is a part of the calculation of Bollinger bands, and is also practically synonymous with volatility.

To illustrate the use of the Standard Distribution indicator, we have chosen to pick a monthly chart of the USDCAD pair on a long series stretching to 1989. The period of our Standard Deviation indicator is 100. Traders generally use their discretion to decide on the period of any indicator, but since forex trends, especially dollar trends are long-lasting, it is a good idea to choose a longer period for the indicator (though 100 not very practical in actual trading conditions).

What we observe is that after the dollar peak in the period between 2000-2001, the established downward trend in the USDCAD pair went on until 2004 without causing any significant movement in the Standard Deviation indicator. This period, in other words, was a great time for joining the trend, as there was no sign that the pair was bubbling up, or acquiring an irrational momentum. After 2004, however, we note that the indicator begins to rise rapidly, until the downtrend ended in December 2007. Although the standard deviation value did not reach the first level of statistical significance (i.e. first standard deviaton at 0.34), we had a clear signal that a bubble was developing. And after 2007, a significant volatility in the price is coupled to a period of indecision, indicating that the bubble is being liquidated.

In hindsight, optimal strategy would be to trade this pattern between 2001-2004, while the final phase after 2007 is not suitable for trading with this indicator because of extreme volatility, and probably a non-gaussian distribution.

## How to Calculate Standard Deviation

At most websites related to forex trading, standard deviation is explained as a measure of volatility. But that doesn’t explain what it is because few traders have a sound understanding of volatility. In order to understand what standard deviation is, we need to become familiar with a few basic concepts from probability theory, and statistics.

## Mean

Mean, or average, of prices in a period of time is defined as

(Sum of (Price x Frequency of Price)) / Period. Or (Sum of All Prices) / Number of Periods

So for instance, if the closing prices of the past five days are 1.25, 1.25, 1.24, 1.20, and 1.23, where the frequency of the first item is 2, the mean would be

((1.25 x 2) + 1.24 + 1.20 + 1.23)/5 = 1.23

Let’s also note here that the probability of of each price is simply the number of times it trades in a period, divided by the total number of price values in the series. In example, if the EURUSD market closes at 1.2 for 3 out of ten days that we desire to examine, the probability would be determined as 0.3 for the time in question. An important rule about probability is that it must always be positive, and its sum over all possible results, must be one.

The terms expected value and mean are synonymous with each other. As the term implies, expected value is the number which we expect the results of repeated tests and trials to converge on over a period of time. If, for instance, there are 365 days in a week, and we know the expected value for the whole year, we would expect the mean price of any period during the year to approach the yearly mean as the number of trades, and the time period involved is increased.

Forex traders are familiar with the concept of means and averages, since the popular and commonplace moving averages depend on the idea that the price oscillates around the center established by the mean. Moving averages sum up all the price values in a period and divide them by the number of time segments where the mean (albeit sometimes modified by additional choices) is the value of the MA.

## Mean deviation

Now that we understand what mean is, it is time to introduce another important concept that is central to the measurement of volatility and standard deviation. Supposing that we have a series of prices with a certain average, or mean, what is the difference between each price and the mean of the series? This value is termed mean deviation. Let’s calculate the mean deviation of the price series in our previous example where the mean was 1.234, and prices = {1.25,1.24, 1.23, 1.2}. The deviation of the first price is 1.25-1.234= 0.016, and in a similar manner, we find the deviation of the remaining prices at 0.006, -0.004, and -0.034, and absolute deviation at 0.016, 0.006, 0.004, and 0.034 (absolute deviation has negative numbers converted to positive). The sum of deviations from the mean in a series is always zero, for example 0.016×2-0.034-0.004+0.006=0

Can we define an expected value for the absolute deviation of prices? In other words, can we take the mean of there mean of absolute deviations of our sample? Of course we can, recall that we calculate the mean by summing up the multiple of prices and their probabilities, and dividing by the number of periods (or in simpler terms, we just sum the prices and divide the result by the total number of prices in the series). We calculate the expected value for mean deviation (or mean absolute deviation) according to the following formula.

E(D) = (Sum of Absolute Deviations)/Number of Elements.

So in our list of absolute deviations at 0.016, 0.016, 0.006, 0.004, 0.034, the mean absolute deviation would be (0.016×2 + 0.006 + 0.004 + 0.034)/5 = 0.0152.

What does this mean? Just as in a series the mean defines where prices will tend to gravitate to as sample size is increased (for example, as we move from a weekly price sample of one week, to two months, and so on) , the mean absolute deviation tells us where the deviation of prices will converge to as the size of the sample rises.

## Variance

We have defined absolute deviation as the mean of the absolute value of differences between each price and the price mean. (Mean of |Price – Mean of Prices|). Variance is a similar concept, but it is defined as (Mean of (Price-Mean of Prices)^2), and the only difference is that here we take the mean of the squares of mean deviation. Variance is also called the second moment, and its square root is the standard deviation. Due to certain relationships in linear algebra, it can also be defined as the difference between the mean of the square of prices and the square of the mean of prices. In other words,

Variance = Mean of (Price-Mean)^2 = Mean of the squares of Price – Square of the Mean of the Price.

Standard deviation is the square root of variance. The reason that we do not use the mean deviation, and prefer variance is that mean deviation can take both negative and positive values, while variance, as a square, is always positive.

## Use of the Standard Deviation Indicator.

It is possible to create many strategies with the probability distribution models, but the most common way that traders use the standard deviation indicator as it is found on the MetaTrader platform is predicting reversals on the basis of the principle of reversion to the mean. Regression to the mean also underlies the principle on which oscillators like the RSI are constructed, and stipulates that each period of deviation from the average must be followed by a return to the same in such a way that the overall distribution of prices will fit the standard distribution. For example, if, after a period of oscillation around the mid of a range, the price moves to the edges, they will eventually revisit the mean, so that when they are plotted over a graph, the rising pattern will be similar to the normal distribution.

While it is widespread in the trader community, and among professional analysts, Gaussian distribution is extremely unreliable to the point of being worthless when the distribution pattern is not normal. In general, highly volatile patterns that have prices clustered at the edges of the trading range are not very suitable to this type of analysis.

## When should I use the Standard Deviation Indicator?

The standard deviation indicator is perhaps the best indicator available to traders in terms of reliability. In markets with stable trends, with moderate volatility where the price action is concentrated around the middle of the range, the STD indicator is better than any other tool that you would find. Indeed, many of the methods that the average hedge fund operator and bank analyst utilize for strategies (such as the VaR, or Value-at-Risk models) are strongly dependent on Gaussian (standard) distribution patterns. So, for instance, if the gold price is oscillating between \$1100 and \$1200 for an extended period of time, with much of the action concentrated in the middle of the range, you can trade the pattern by assuming mean regression on the basis of standard distribution, as we discussed above. On the other hand, if within the same range, prices are clustered at the edges, say, around 1100-1120, and/or 1180-1200, the probability distribution of the prices may not be Gaussian, and using the STD indicator signals for trading, and assuming mean regression may easily result in a disaster.

This point is quite important, as it is also one of the major disadvantages to trading with MAs in general. The mean of prices will be the same in both a tail-heavy pattern where much of the action takes place at the edges of the range, and one where it is concentrated in the middle, but these two patterns obey completely different rules, and applying the same mean regression strategy on the basis of a basic reading of the market action is sure to result in disaster. So, we repeat once again that to apply this indicator correctly, you should first analyze the distribution of prices, as well as the range and the long term trend in which they exist.