Calculating an EMA - Need help!

Discussion in 'Technical Analysis' started by qtip, Jul 7, 2005.

  1. qtip

    qtip

    Hello all, need help calculating and EMA on paper.

    Yes, I know computer charting programs can do this for me:)

    I am looking to calculate the EMA for the last 10 days based off the close price.

    I am looking for the absolute value rather than the %.

    Thanks for your help!

    :p
     
  2. qtip

    qtip

    Please help me!

    Someone most know:)
     
  3. kut2k2

    kut2k2

    EMAtoday = (smoothing_constant)*CLOSEtoday + (1 - smoothing_constant)*EMAyesterday

    This is what is called a recursive formula. The best way to start off an EMA is to average the first n-1 data. In this case, n-1 = 9. So average the first nine days the "old fashioned way", i.e., add up the first nine closes, then divide the sum by nine. This is the first EMAyesterday.

    From then on, you can use the EMA formula:

    The smoothing constant is 2/(n+1).

    So, for a 10-day EMA, the formula is

    EMAtoday = (2/11)*CLOSEtoday + (9/11)*EMAyesterday

    Enjoy :cool:
     
  4. qtip

    qtip


    thanks so much! Is the smoothing constant always 2, or do I choose the constant myself. If so, is this the same as the period?
     
  5. The smoothing constant is 2/(1+n) where n is the number of days for the averages period, ie a 15 day EMA has a smoothing constant of 2/16 or 0.125.

    DS
     
  6. omniscient

    omniscient Guest

    looks like you already got some help, but fwiw:

    http://stockcharts.com/education/IndicatorAnalysis/indic_movingAvg.html

    http://www.decisionpoint.com/TAcourse/MovingAve.html

    http://www.forex-markets.com/moving_average.htm

    hth

    take care and gtty -

    omni
     
  7. kut2k2

    kut2k2

    The smoothing constant is never 2; it is always a value between zero and one.

    Here's where 2/(n+1) comes from.

    A simple moving average (sma) is based on the basic statistical idea of averages. If you have seven people in a group, you can find their average weight by adding the seven weights and dividing by 7. You can apply the same principle to average any group of numbers. A moving average is just an average of a single quantity that changes over time, e.g., closing prices. The basic moving average is called a simple moving average because all the values are treated equally. This is in contrast to a weighted moving average (wma), where the more recent values are given more weight than older values.

    The advantage of the sma is that you reduce the variance (read: noise) of the data. In other words, you smooth things out. The disadvantage is that, because you're mixing old data together with new data, your average is more representative of the past than the present. This is called lag. The wma has less lag than the sma for a given value of n (= the lookback period, or sample size), but this is at the cost of more variance. There is always a trade-off between smoothing and lag with moving averages.

    Now look at the exponential moving average. The proper name for this beastie is simple exponential smoothing (ses), and it really represents an infinite geometric series. You can go through the math and show that the ses also performs smoothing of data, at the cost of introducing lag into the output. The smoothing constant is generally represented by the Greek letter alpha, but I'll just use "A" here.

    Believe it or not, all this build-up has a point. :D

    The reason ses is commonly referred to as ema (exponential moving average) is because you can establish an equivalency between ses and sma.

    I will state the following without proof:

    The lag produced by ses is (1 - A)/A.

    The lag produced by sma is (n - 1)/2.

    If we set the two lags equal to each other, we get

    A = 2/(n + 1)

    So we can talk about, say, a '10-day ema', even though strictly speaking, A represents a fraction between 0 and 1, not a real sample size of data like n.

    hth
     
  8. nkhoi

    nkhoi

    are you thinking about pitbull 10 day ma
    "Mr. Schwartz calculates the 10-day moving average by hand every day (according to the book) by taking the last 10 days of the current SP500 future price and dividing by 10. You keep a running chart of it by taking the current 10 Day "Pit Bull" number that you calculated yesterday, multiplying it by 10, then adding today's closing SP500 futures price to that figure.

    You then count back 10 days starting with yesterdays SP500 close and subtract that number from the total. You then divide that figure by 10 and round up or down to the nearest 10 Now you have the 10 Day "Pit Bull " moving average for today's trading action. It is not the same as the conventional 10 day moving average or exponential moving average that can be quickly tapped into a computer. This is not to say a computer can't calculate it but Marty does it by hand and recommends doing it by hand. That's good enough for me! The guy has made millions trading the SP500 and you may not want to fade that advice. Besides, it keeps you on your math toes. "

    to get price day by day use this quote look up
    http://bigcharts.marketwatch.com/hi...ect=1&symbol=$spx&close_date=7/7/04&x=23&y=23