• Mathematics, Trading

    Posted on September 17th, 2009

    Written by Richard

    Tags

    ,

    The EMA and RC Circuits

    The EMA and RC Circuits

    In this installment of my series on the Exponential Moving Average, I point out the relationships between the EMA and simple analog RC circuits. Electronics really isn’t my thing, but I found this to be interesting and kinda beautiful.

  • Mathematics, Trading

    Posted on September 7th, 2009

    Written by Richard

    Tags

    ,

    How Well Do EMAs Track Parabolic Curves?

    How Well Do EMAs Track Parabolic Curves?

    In the last post, we went over how well EMAs track straight lines in detail. Now, it’s natural to wonder how EMAs do with sources modeled after:
    s[t] = m t^2
    It turns out, they don’t do very well at all. Here’s our standard 20-ema of the basic parabola with ‘m’ = 1:

    As you can [...]

  • Mathematics, Trading

    Posted on September 5th, 2009

    Written by Richard

    Tags

    ,

    How Well Do EMAs Track Straight Lines?

    How Well Do EMAs Track Straight Lines?

    We know from a couple posts ago that the EMA of a constant is equal to that constant. In other words, EMA’s track a DC signal perfectly. It might be natural to wonder how well they do against a straight line.
    Recall that a line has a slope ‘m’ and an offset ‘b’ at [...]

  • Mathematics, Trading

    Posted on September 4th, 2009

    Written by Richard

    Tags

    ,

    The Exponential Moving Average is Invertible

    I never noticed this until today, but the EMA filter is 100% invertible. That means, if you give me an ema-smoothed dataset, I can tell you what the original dataset was. You would think, as a low-pass filter, that it would be throwing away the high-frequency data, but it’s not. It’s just [...]

  • Mathematics, Trading

    Posted on September 3rd, 2009

    Written by Richard

    Tags

    ,

    A Few Algebraic Properties of EMAs

    Here are a few algebraic properties of EMAs:

    ema(constant) = constant
    ema(s + t) = ema(s) + ema(t)
    ema(s + constant) = ema(s) + constant
    ema(s * constant) = ema(s) * constant
    ema1(ema2(s)) = ema2(ema1(s))

    Also, recall that the standard ‘bar form’ of an EMA, such as when we say “20-ema,” is actually specifying the ema [...]

  • Trading

    Posted on September 1st, 2009

    Written by Richard

    Tags

    ,

    Initial Value of an EMA

    Initial Value of an EMA

    The definition of an EMA:
    ema[t] = (1-alpha)*ema[t-1] + alpha*data[t]
    … tells you what to do with the last EMA you had and the current data sample. That’s all fine and good, but how do you get started? In other words, how do you get your first EMA value? The formula above is no [...]

  • Mathematics, Trading

    Posted on August 31st, 2009

    Written by Richard

    Tags

    ,

    The Welles Wilder MA

    My EMA article will be as comprehensive as I can manage. I’m going to try to cover every facet of the EMA that I’ve heard of. If there are any topics you’d like to see covered, write them in as comments so I will be sure to include them. Here’s another [...]

  • Mathematics, Trading

    Posted on August 25th, 2009

    Written by Richard

    Tags

    ,

    EMA Accuracy After n Historical Bars

    In case you can’t tell, I’m working on the mother of all EMA articles. A couple parts have been posted here so far. As I pointed out, my plan is to post bits on the blog prior to the article, for two reasons:

    it keeps me moving forward, without the pressure of polishing the [...]

  • Mathematics, Trading

    Posted on August 17th, 2009

    Written by Richard

    Tags

    ,

    SMA vs EMA Calculations

    Over the weekend, Jeppetto asked:
    “Why do EMA’s require fewer resources to calculate?”
    The SMA Case
    An SMA is a moving sample mean. So lets consider the 12 SMA and the 100 SMA for examples. In the 12 SMA, the naive calculation on each new bar is to add up the last 12 closes and divide [...]

  • Trading

    Posted on August 12th, 2009

    Written by Richard

    Tags

    ,

    When SMAs are What You Need

    You know, EMA’s are pretty attractive compared to SMA’s. They look smoother, they require fewer resources to calculate, they aren’t restricted to a smoothing amount based on a bar count, etc. One might look at the evidence, and ask: Why would I ever use an SMA over an EMA?
    Here are a couple scenarios:

    If [...]

PHVsPjxsaT48c3Ryb25nPndvb19hYm91dDwvc3Ryb25nPiAtIGh0dHA6Ly93d3cubW92ZXRoZW1hcmtldHMuY29tL2Jsb2cvcmljaGFyZC88L2xpPjxsaT48c3Ryb25nPndvb19hZF9mb290ZXI8L3N0cm9uZz4gLSBmYWxzZTwvbGk+PGxpPjxzdHJvbmc+d29vX2FkX2Zvb3Rlcl9hZHNlbnNlPC9zdHJvbmc+IC0gPC9saT48bGk+PHN0cm9uZz53b29fYWRfZm9vdGVyX2ltYWdlPC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tL2Fkc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