Exponential Moving Average

Originally posted by rrisch
I think a psychologist would have a field day, observing some of the ridiculous comments here from people who are probably compensating for their poor performance in the stock market by trying to impress their fellow traders by bluffing that they have some scientific understanding of what they do. Unless you have a math/scientific background, please do not comment on this thread. Thank you. :p

I guess you must mean my comment. Interesting that you didn't answer the question before I attempted to, but waited to see whatever anyone else would answer.

Its always cheaper in the "cheap seats", that way not only does the view never change, but you never put yourself up for ridicule.

Just step into the frey, and when you do, tell us all how you use SMA's and EMA's and how you profit$$$ from it.

Afterall, whether this is a mathematical discussion or a trading discussion, its a discussion. And, most of all, we aren't in college, where one can get credit simply for asking "why". This is the real world, and one has to answer not only why, but "what", as in "what did you do"?
 
Originally posted by rrisch
Thank you TriPack. Unlike the other people who replied, you at least understood the question. :D . AFAIK, the appelation, "exponential" applied to this moving average, is a misnomer. It should be called the "geometric" moving average since the weights used, are the same as the weights for the geometic distribution, described in books on probability and statistics. I don't see what the "Rule of 70" of the reference, has to do with my question, but perhaps some other reader can explain it.

rrisch/ppoor whatever, you seem to have the answer for your question, so what exactly are you looking for?, and how does it affect the price of tea in China?, IOW, how is it significant towards trading or chart reading?
 
Originally posted by rrisch
I'll be waiting with baited breath Vikana. I would very much like to understand how a moving average is "behind" the time series.:)

That wouldn't be a hint of sacrasm, would it ? Anyway, I'll certainly post the explanation as I promised last night.

First let's look at a SMA (simple moving average). Let's take a simple example where the prices are: 1 at bar 1, 2 at bar 2, etc.
Let's calculate a 5 bar SMA. We add the 5 most recent prices and divide by 5, so e.g. the SMA at bar 5 is 3. See the attached picture. Note how the SMA is 2 bars behind the actual data. This is the lag. In general, for a SMA over N elements, the lag is (N-1)/2.

Now to the exponential MA, which is defined as
ema(t) = a*Price + (1-a)*ema(t-1);
You called "a' percent above.

To calculate the lag for the linear growth (as above) assume that the price is p on this bar. Call the lag L. Then the value of the ema on this bar is (p-L). Insert in the ema formulate above

(p-L) = a*p + (1-a)*(p-L-1)

Solve for a to get: a = 1/(L+1)

To compare to a SMA with lag (n-1)/2 we get a = 2/(n+1)

That's it. Hope this was helpful.
 
Thanks, Vikana. maybe we are making progress. First of all, is the general definition of Lag, Time Series[n] - Moving Average[n]?

If so, it is clear that the Lag, in general isn't constant. Now I agree with the part that says for the SMA of a linear series with slope 1, Lag = (n -1)/2.

However I can't make head or tail out of this part:
(p-L) = a*p + (1-a)*(p-L-1)

You seem to be saying that your EMA has the property,
EMA[n - 1] = EMA[n] - 1. Exactly where does that come from?

I hope you can fill in these details. By the way, isn't there a reference for this? In emails, two well known authors on technical analysis confessed they hadn't the foggiest idea where the 2/(N+1) formula comes from. :confused:
 
Originally posted by rrisch
I hope you can fill in these details. By the way, isn't there a reference for this? In emails, two well known authors on technical analysis confessed they hadn't the foggiest idea where the 2/(N+1) formula comes from. :confused:

An SMA is a Fininte Impulse Response (FIR) filter. The lag, or delay, of any end-to-end symmetric (or anti-symmetric) FIR is approximately one half the filter length. In the case of a time series SMA, the lag of an SMA is exactly (N-1)/2. So a 7-bar SMA has a lag of exactly 3 bars. This lag is referred to as the "group delay" in engineering terms. [Group delay is defined as the rate of change of phase with respect to angular frequency.]

Regarding the 2/(N+1) for the period in the alpha calculation of an EMA, while I don't know the origin of the formula, the reason the MA is called "exponential" (to answer one of your original questions) is the way an EMA's transfer response decays is in amplitude over N bars. [e.g. The most recent value of the time series is weighted by alpha, the next most recent value is weighted by alpha*(1-alpha), the next value by alpha*(1-alpha)^2 .... the Nth value is weighted by alpha*(1-alpha)^N.]

Note that for any given period N, the weight of alpha*(1-alpha)^M where M>N, the weighting affect on the MA approaches zero as M increases, hence for practical purposes, the formula of alpha=2/(N+1) generally describes the affect of the EMA weight N periods back.

The concept of "period" in an EMA is approximate, unlike an SMA or WMA where it is exact. MA's get more interesting when you starting looking at Digital Signal Processing, when you start looking at phase changes. SMA's and WMA's have linear phase lag defined by the fixed period, but EMA's, due to the recursive nature of its calculation, has a nonlinear phase lag.
 
Whoa!....Fininte Impulse Response (FIR) filters! Very important point...can't afford to neglect the finite impulse response filters...could really make the difference between making mere thousands and making millions! (STOCKDANCE you reading this??) :)

Daniel


(Joking only dottom, this VERY informative stuff)
 
Originally posted by daniel_m
Whoa!....Fininte Impulse Response (FIR) filters! Very important point...can't afford to neglect the finite impulse response filters...could really make the difference between making mere thousands and making millions! (STOCKDANCE you reading this??) :)
The beauty of this forum is that I can selectively steer clear of threads which don't interest me - the thread title being the main indicator. What did you expect to find in a thread entitled "Exponential Moving Average"? Be warned that once we have exhausted the simple, weighted and exponential moving averages, we intend to focus our attention on the properties of the Wilder Moving Average, Least Square Moving Average, Adaptive Moving Average, Endpoint Moving Average, Triangular Moving Average, Sine Weighted Moving Average, Modified Moving Average, MESA Adaptive Moving Average, Elastic Volume Weighted Moving Average, Indicator Adjusted Average and Indicator Weighted Average, not necessarily in that order. :p
 
Originally posted by tom_p

The beauty of this forum is that I can selectively steer clear of threads which don't interest me - the thread title being the main indicator. What did you expect to find in a thread entitled "Exponential Moving Average"? Be warned that once we have exhausted the simple, weighted and exponential moving averages, we intend to focus our attention on the properties of the Wilder Moving Average, Least Square Moving Average, Adaptive Moving Average, Endpoint Moving Average, Triangular Moving Average, Sine Weighted Moving Average, Modified Moving Average, MESA Adaptive Moving Average, Elastic Volume Weighted Moving Average, Indicator Adjusted Average and Indicator Weighted Average, not necessarily in that order. :p

Wow.

Glad I found this thread, I thought there was a piece missing in the puzzle somewhere.

Just joking.
 
Back
Top