MetaStock Standard Deviation Function

Provided By

Standard Deviation is simply a statistical measure of volatility. It measures how widely values (e.g. closing prices) are spread from the average (e.g. mean closing price). The more dispersed the data is, the higher the `deviation' and the higher the volatility. The lower the deviation, the lower the volatility.

Often, standard deviation is used to calculate indicators such as Bollinger Bands. It's often used when trading derivatives, since it provides a good indication of a security's volatility, which greatly affects the pricing of derivatives.


Standard Deviation is derived by firstly calculating a simple moving average of the selected data array (eg., the closing price or an indicator), and summing the squares of the difference between the data array and its moving average. This value is then divided by the number of periods over which it is calculated. Finally, the square root of this result is calculated. Fortunately, MetaStock does all the hard work for us.

SYNTAX Stdev(Data Array, Periods)

Data Array _ This is the data array used to determine the standard deviation.

Periods _ This specifies how many periods are used to determine the standard deviation of the data array.


Here is an example using the Standard Deviation:


In the above example:

Data Array = C

Periods = 20


A more useful application of this example could be:


This formula checks that the present value of the 20 period standard deviation of the close, is within 5 percent of its all time low. This identifies securities with low volatility.

This article is a snippet from the
MetaStock Programming Study Guide...

"Discover The Simple Secret to Make Metastock Easy & Identify Profitable Trades"

Click Here To Find For More About
The MetaStock Programming Study Guide

copyright 2007