John,
from the metastock help file...
A 4-period Standard Deviation indicator can be written as follows. The first stateement assigns a 4-period simple moving average to the variable named "4PeriodMA". The second statement sums the squares of the differences between the moving average and the closing prices on each of the preceding four periods. It then calculates the square root of this total. 4PeriodMA:= mov( close, 4, S );
sqrt(( power(4PeriodMA) - C, 2) +
power(fml(4PeriodMA)- ref(C,-1), 2) +
power(fml(4PeriodMA)- ref(C,-2), 2) +
power(fml(4PeriodMA)- ref(C,-3), 2) ) / 4 )
An easier method is to take the square root of the variance function as shown below: sqrt( var( close, 4 ) ) Of course, the easiest way is to write the Standard Deviation formula using the predefined stdev() function (see Standard Deviation).
OR
SYNTAX stdev( DATA ARRAY, PERIODS ) FUNCTION Calculates the predefined Standard Deviation indicator. EXAMPLE stdev( CLOSE, 21 )
Don't know how to create a data array out of your MA values so you might have use technique #1....
Sean |