Exponential Moving Average

Discussion in 'Trading' started by rrisch, Apr 14, 2002.

  1. rrisch

    rrisch

    It seems that everyone is having fun on this thread but the originator. I am as much in the dark about what a 20 day ESA has to do with 20 days as I was at the start. I am coming to the conclusion that 99.999% of the people who proudly use EMAs don't understand them and shouldn't use them or indicators based on them.

    As an example, I am attaching a gif of the 50 and 200 ESA of the Nasdaq from two different charting sites. It was sent to me by the Webmaster of an Investment site who uses ESAs his analysis.
     
    #31     Apr 17, 2002
  2. rrisch, do you speak German? You seem to think like someone who would.

    Concerning your original question, I have wondered myself for several months and have not found out yet either. Before I read your post, I was just assuming that the number of days for an EMA was defined through a fixed percentage somewhat like this:

    Let the number of days N for a p% EMA be the smallest natural number so that if you change all price quotes for all days longer than N days in the past to zero, the EMA would change by no more than 5% (or 1% or whatever fixed percentage the inventor might have thought of).

    However, I see now that this definition is flawed in itself, since theoretically the stock price could have been any large number M exactly N+1 days ago, and replacing M by zero would change the given EMA by M*p^(N+1), which can be indefinitely large if p and N are fixed (which they obviously are).

    On the other hand, what the preceding paragraph proves is just that there are "extreme" situations where it is highly inaccurate to assign an EMA any fixed number of days.

    The definition is probably similar to my first attempt, only that you have to account for a greater number of variables statistically.

    I tend to agree with you, however, in that most traders probably never wonder why a certain percentage is defined to correspond with a certain number of days (and it obviously is nothing more than a definition, since we can construct ficticious qoutes for which the N-day EMA is changed by 10000% or more by only changing the price quote of N+100 days ago).

    What do you think?
     
    #32     Apr 17, 2002
  3. dottom

    dottom

    Robert, I gave you the answer already.

    The concept of a "days" or "N periods" in an EMA is approximate with respect to affect of the smoothing constant (i.e. alpha) M bars back where M>N.

    In other words, if you take a 20-bar EMA (i.e. an EMA with a smoothing constant of alpha=2/21), the affect of the smoothing constant N bars ago where N>20 quickly approaches zero.

    Take a 2-bar EMA. What is the affect of the smoothing constant past 2-bars? Take a 10-bar EMA, how quickly does the alpha*(1-alpha)^N approach zero when N>10?

    As I said before, the concept of a "period" in an EMA is approximate. An EMA is an Infinite Impulse Response (IIR) filter and does not have a fixed window like an SMA or WMA (which are FIR filters), but you can approximate the number of periods the smoothing constant has a practical affect.

    Here was my original response:

    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...
     
    #33     Apr 17, 2002
  4. rrisch

    rrisch

    "Robert, I gave you the answer already."

    ROTFL. The posts that have appeared in the thread make me wonder if anything on this site is worth reading. I've written to 8 well known authors on technical analysis. Six have replied and said that they don't have the foggiest as to what an N day EMA has to do with N days. The difference between them and the cretins here, who keep trying to explain what they don't understand or insult me for asking a good question, is that there is an editor between the former group and getting published. As a friend of mine once put it, "The Internet is too democratic".
     
    #34     Apr 17, 2002
  5. dottom

    dottom

    I will agree with you on one thing - the signal-to-noise ratio is very poor around here. That is why I haven't posted as often as I used to. I was trying to help, but obviously you're looking for a different answer than what I provided.
     
    #35     Apr 17, 2002
  6. tom_p

    tom_p

    As the thread originator, you should be enjoying all this. Your charts don't surprise me as I've seen reference made to the fact that there are variations of the definition of EMA. In fact, look at the following excerpt taken from what seems like a highly respectable source (take a look at their client list www.oir.com/about_clients.htm) :

    "For an exponential moving average, the values for each day are weighted differently using an exponential factor which gives greater importance to the values of the more recent days. In either case, however, the moving average is interpreted basically the same way for analysis.

    For those who are interested, the formula for an exponential moving average (EMA) for n-days is:

    n-day EMA = (1/n x new settle price) + [(1-1/n) x yest EMA)]

    e.g., 3-day EMA = (1/3 x new settle price) + (2/3 x yest EMA)

    A detailed discussion of exponential moving averages can be found in Kaufman's book The New Commodity Trading Systems and Methods."

    (From p.10 www.oir.com/Manuals/Techman/techman.pdf)

    Robert, note the last sentence - I'd be interested if Kaufman really uses the above definition.

    What now?
     
    #36     Apr 17, 2002
  7. rrisch

    rrisch

    Thank you Tom, that was a good post. :) . I've seen the definition of EMA you give: n-day EMA = (1/n x new settle price) + [(1-1/n) x yest EMA)], in Welles Wilder's book, published in the late 70s. That definition, using a = 1/n, seems to have more to do with n days than the a = 2/(n+1) that all the current books and web sites use. Some old timer here might be able to remember when the definition changed. With that hint, maybe we will have a clue as to why.
    :eek:
     
    #37     Apr 17, 2002
  8. No, that specific case to find an equivalent lag was for the linear function given at the top of the post, ie price(1) = 1, price(2) = 2.
    In general the ema is given by the formula with the a in it.
     
    #38     Apr 17, 2002
  9. rrisch

    rrisch

    Vikana, the EMA of a linear series isn't linear. The Lag is not constant. I don't know what you are talking about or trying to show. Why not make believe you are back in school and writing out a precise argument?
     
    #39     Apr 17, 2002
  10. Banjo

    Banjo

    A man after fourteen years of hard asceticism in a lonley forest obtained at last the power of walking over the waters. Overjoyed at this aquisistion, he went to his guru, and told him of his grand feat. At this the master replied, " my poor boy, what thou hast accomplished after fourteen years arduous labor, ordinary men do the same by paying a penny to the boatman."
    Sri Ramakrishna, Indian 1834-1886
     
    #40     Apr 17, 2002