The moving average is probably the most commonly used of all
indicators. It comes in various types and has numerous applications. In basic
terms though, a moving average helps to smooth out fluctuations in price (or an
indicator) and provide a more accurate reflection of the direction that the
security is moving. Moving averages are lagging indicators and fit into the
trend following category. The various types include simple, weighted,
exponential, variable, and triangular.
CALCULATION
The difference between the various types of moving averages
is simply the way in which the averages are calculated. For example, a simple
moving average places equal weighting on each value in the period; weighted and
exponential place more emphasis on recent values in the period; a triangular
moving average places greater emphasis on the middle section of the time period;
and a variable moving average adjusts the weighting depending on the volatility
in the period.
Let's focus on the simple moving average, which is formed by
finding the average price of a security over a set number of periods. This is
calculated by adding up the closing prices of the security over the set number
of periods (eg. 15) and dividing this summed answer by the number of periods.
With regards to the other types of moving averages, their
calculations can be a little more complex; however the premise is still the
same. The only difference being where and how the relevant weightings are
placed.
SYNTAX Mov(Data Array, Periods, E S T TRI VAR W VOL)
Data Array _ This is the data array that will be averaged to
form the moving average indicator. This is most often the closing price, but can
be any other price data or indicator.
Periods _ This specifies how many periods are used to
calculate the moving average.
E S T TRI VAR W VOL _ This is the type of moving average that
is to be used, shown as follows:
E _ Exponential S _ Simple T _ Time Series
Tri _ Triangular Var _ Variable W _ Weighted
Vol _ Volume Adjusted
EXAMPLE
The following formula plots a 15 period simple moving average
of the closing price:
Mov(C,15,S)
In the above example:
Data Array = C
Periods = 15
Type = S (Simple)
APPLICATION
A more useful application of this example could be:
C>Mov(C,15,S) and V>Mov(V,20,S)
The formula above specifies that the closing price must be
above a 15 period simple moving average (denoted by `C>Mov(C,15,S)') and that
the present volume must be greater than the 20 period average of the volume
(denoted by `V>Mov(V,20,S)').
Looking at Figure 3.27, we can see a 15 period simple moving
average applied to the chart.
Figure 3.27 _ Moving Average Indicator
EXERCISES
Construct formulas for the following:
1. The closing price crossing over a 20 period weighted
moving average of the close and the 30 period simple moving average of the close
is greater than the 50 period simple moving average of the close:
__________________________________________________
This
article is a snippet from the
MetaStock Programming Study Guide...
"Discover
The Simple Secret to Make Metastock Easy & Identify Profitable
Trades"

copyright 2007 www.metaformula.com