Sunday, May 30, 2010

Best value for parameters used in MACD

What are the best or most optimum values to use for the parameters in MACD calculation ?

The default values as suggested & used by most market technicians is 12,26,9. Is this a holy grail? As in does this necessarily have to be the best possible values - no, i don't think so. One can use whatever values one wants, and ofcourse the results would vary accordingly. It is not necessary to use the default values only. One can tweak around to find other values which would give better results. In some markets lower values work better, in some higher values work better. In general, what I have seen is that for markets which are very trending, having a lower value for the shorter moving average gives better results.

The best possible values can only be determined by back-testing but then that again is prone to curve fitting and might not necessarily work in the future.

Friday, May 28, 2010

How to calculate MACD

MACD calculation is simple & easy, though it may seem complicated at first.

a. Calculate 12 day Moving average
b. Calculate 26 day moving average
c. Take their diff (12-26)
d. Calculate 9 day moving average of this diff as calculated in step c
e. Take the diff of values calculated in steps c & d
f. If this value is positive trend is up, if negative trend is down.

On charts values c & d are plotted as lines & f as an histogram. C is called MACD. D is called Histogram

To make things simple for you I have done the MACD calculation of Dow Jones in excel. You can download the same from here.

Thursday, May 27, 2010

Intraday MACD Calculation

The formula for calculating intraday values of MACD is the same as that for the daily. You can see how formula for calculating MACD here or see an excel example of macd calculation.

Sunday, May 23, 2010

What really does the MACD do?

For someone who wants a deeper understanding of what exactly are we doing with MACD you first need to understand what we are doing using technical indicators in general, & moving averages in particular.

First - All technical indicators are derivatives -
In the sense that their values are derived from either price or volume of underlying asset. So Moving Averages, RSI, MACD, Stochastics, Average True Range are all indicators. Contrast these with other technical analysis terms you may have heard like Head & Shoulders, Trendlines, Triangles, etc. These are also actively used by technical analysts, but these together are part of a group called technical patterns. These are visual in nature, as compared to indicators which are numerical in nature.

Second - What are we trying to achieve with indicators?
We are trying to analyse price/volume behavior of a stock in terms of numbers and trying to generate some meaning or a tradeable idea out of them. Converting price action into numbers & then chart the numbers also allows one to get both a numerical & visual feel for price movement.

Third - What do we achieve with moving averages ?
We are trying to filter out noise to develop a better or a general picture of where prices are moving to. Its just like having a look at an index to gauge where prices of various stocks are moving in general. So, moving averages act as filters to remove noise from movements in each timeframe & to be able to see the big picture instead.

Fourth - What are we doing with MACD
When we calculate MACD, we are then doing multiple filter analysis - that is we are running price through multiple filter (instead of just one - in case of moving average) to get an even more refined picture of trend & movement of prices. So when we take the difference of two moving averages & calcute its moving average, we are essentially applying a double filter to prices to smoothen out noise. In mathematical terms, if Moving average is the first derivative, then MACD is the second derivative.

Saturday, May 22, 2010

MACD Basics: How is MACD Calculated?

How is MACD Calculated. MACD uses past price data to calculate the values of the particular lines.

a. First we need to calculate two moving averages.

Shorter aoving average - 12 periods including current close
Longer moving average - 26 periods including current close

b. Now we take their difference (shorter minus the longer). This value is called MACD

c. Next we calculate a 9 period moving average of the MACD. This value is called the signal line

d. These two values - the MACD & the signal line are then plotted on a graph to come up with what looks like the MACD indicator in this example below -

When the MACD is above the signal line the trend is up & vice versa. The blue bars are called histograms - a plot of the difference between the MACD & the signal line.

For an example of how to calculate MACD in excel do have a look at this page which shows how to calculate MACD for dow jones in excel

MACD Basics: What is MACD ?

MACD stands for Moving Average Convergence Divergence - yeah, pretty long & seemingly meaningless, which is why everyone chooses to call it MACD or MAC-D.

In simple language - it is an technical indicator used by technical analysts to determine direction & strength of a trend & to take trades on its basis. All technical indicators are determined from the price or volume of the underlying asset. Moving averages are the simplest of these. MACD is an advanced or rather more refined indicator. It uses 3 separate sets of Moving Averages to come up with a signal.

The shorter moving average. Typical value used - 12 periods
The longer moving average. Typical value used - 26 periods
Then there difference is calculated, which is called the MACD

Next a moving average of the MACD is calculated. Typically a 9 period MA is calculated. This is called the signal line.

When the value of MACD is greater than that of the signal line the trend is up, else trend is down.

Sunday, May 10, 2009

How to calculate MACD in excel?

Want to know how to calculate the values for MACD in excel? Here's an easy way out. I have shown the calculation of MACD formula in an excel sheet on data of Dow Jones. You can download the see exactly how the macd calculation is performed in excel and replicate it with any data.

If there are any problems with the download, kindly leave a comment here.