exponential moving average from MOVAVG not correct?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

exponential moving average from MOVAVG not correct?

Tim R
Does anyone else have experience using the MOVAVG function with exponential weighting ('e')?  If I don't specify the 'e' weighting, then I correctly get a simple moving average.  But when I specify 'e' I get numbers that don't seem correct.  I'm curious if the exponential weighting used here is somehow different from what is commonly assumed.  For example, to calculate stock price trends, one typically computes MACD (moving average convergence divergence) by doing:
 
MACD = (12-day exponential moving average) minus (26-day exponential moving average)
 
So in Octave, I did the following:
 
[Short_ma, Long_ma] = movavg(data(:,Price),12,26,'e');
MACD = Short_ma - Long_ma;
For a typical stock, the MACD value is usually in the single-digits.  But both my Short_ma and Long_ma track Price very closely, and hence MACD stays in the range of +/-10^-4, which clearly is incorrect.  Help please?

_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: exponential moving average from MOVAVG not correct?

bpabbott
Administrator

On Feb 23, 2010, at 2:33 PM, Tim Rueth wrote:

> Does anyone else have experience using the MOVAVG function with exponential weighting ('e')?  If I don't specify the 'e' weighting, then I correctly get a simple moving average.  But when I specify 'e' I get numbers that don't seem correct.  I'm curious if the exponential weighting used here is somehow different from what is commonly assumed.  For example, to calculate stock price trends, one typically computes MACD (moving average convergence divergence) by doing:
>
> MACD = (12-day exponential moving average) minus (26-day exponential moving average)
>
> So in Octave, I did the following:
>
> [Short_ma, Long_ma] = movavg(data(:,Price),12,26,'e');
> MACD = Short_ma - Long_ma;
> For a typical stock, the MACD value is usually in the single-digits.  But both my Short_ma and Long_ma track Price very closely, and hence MACD stays in the range of +/-10^-4, which clearly is incorrect.  Help please?

The movavg() function is part of the financial package and not part of octave's core. Please email the list associated with Octave-Forge.

        http://sourceforge.net/mailarchive/forum.php?forum_name=octave-dev

Ben


_______________________________________________
Help-octave mailing list
[hidden email]
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave