Thursday, August 25, 2011


MACD Technical Analysis with Tableau

Moving Average Convergence Divergence (MACD)

As a follow up to my previous post on Bollinger Bands, I took a stab at MACD, which derives from similar calculations.

This is a somewhat squirrely subject and I might be opening myself up to attack or a can of worms in this attempted analysis. As a preemptive strike against such attacks, let me start off by saying that as a stock trader, I fall firmly in the "fundamentals" camp, and this type of technical analysis does little for me. Second, allow me to graciously further admit that my math could very well be wrong. Finally, grant me the chance to comment on the fact that we can find on the internet dozens and dozens of permutations on the mathematics of this MACD subject.

Three web links which I found quite helpful in understanding the math behind MACD are these:

The Wikipedia Page on MACD
The Wikipedia Page on Moving Averages and Exponential Moving Averages
which are required components of MACD analysis, and lastly,
A Stock Charts Dot Com web page which has a nice discussion on the subject.

Feedback on the mathematics is welcome.

5 comments:

Joe Mako said...

I can understand the benefit of not synchronizing the axes for the bottom chart with the histogram, but why not synchronize the the axes on the top chart with the close and EMA amounts?

It is a very nice comfort when all table calcs use the same compute using setting.

northwestcoder said...

Good catch. I meant to do that and spaced out. It's updated now... :)

Joe Mako said...

I learned today that your formula for EMA is incorrect in a few ways. 1. your simple moving average (SMA) start,end is set to -12,0 when it should be -11,0 for a 12 day simple moving average. 2. in your formulas for exponential moving average (EMA), the argument in your previous_value function should not be the first, it should be a lookup of the first simple moving average that has a complete range, so a lookup of the SMA with an offset of first()+11 for the 12 day average. See http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:moving_averages for a better example and details.

northwestcoder said...

Beautiful Joe. If there is anyone that could correct this work, it's you. I'm stacked this week but will take some time to add these corrections and post back. Thanks, again...

Leo Pl said...
This comment has been removed by the author.