Jump to content



Photo

A Guide to MACD and Price Strength


  • Please log in to reply
3 replies to this topic

#1 borland

borland

    Member

  • Traders-Talk User
  • 276 posts

Posted 23 November 2008 - 07:35 PM

Stockcharts.com provides an excellent educational resource for technical indicators. Unfortunately, they only adequately describe three bullish features as follows: Positive Divergence, Bullish Moving Average Crossover, and Bullish Centerline Crossover. They really don't do a good job of explaining the bullish properties of the histogram. Here's the link to Stockchart's Chart School on MACD.

I've compiled a comprehensive breakdown table of the MACD chart patterns. This covers every conceivable pattern on a bar to bar move MACD patterns are listed from strongest price strength on top to weakest price strength at the bottom. You'll find this is true regardless of interval length (5, 15, 30, 60, D, W, etc.). I've also listed entry strategies and expected trade duration based on the daily bar.

Posted Image

Note that I've listed more bullish patterns than bearish, and the relative strength when compared to the Primary Trend which I've based on the 50/200EMAs.

For automated trading, you need a mathematical model and a strategy in mathematical terms. This next table provides basis for defining the mathematical terms for the conditions of entry and exit. So, there are only two rules that govern the entries and exits.

Posted Image

For the entry, rather than check each bullish pattern (A-I) one at a time, I've colorized the tests that would give the same result. Same for the exits.

So, in StrategyDesk, the Boolean logic formula for this entry strategy would look like this.
(
  { MACD Strength Long Entry}

  MACD[Diff,Close,12,26,9,D,0,$COMPX] >= MACD[Diff,Close,12,26,9,D,1,$COMPX]
  OR
  (
    MACD[Diff,Close,12,26,9,D,0,$COMPX] >= 0
    AND
    MACD[Signal,Close,12,26,9,D,0,$COMPX] >= 0
    AND
    ExpMovingAverage[EMA,Close,50,0,D,1,$COMPX] >= ExpMovingAverage[EMA,Close,200,0,D,1,$COMPX]
  )
)

For the exit, you'd might think you could just reverse ">=" operators, but it's not that simple, and if you had, you'd miss some patterns

As a side note: StrategyDesk only has two logical operators, AND and OR. It would be nice if it had the NOT logical operator. If it had, you could just place the NOT in front of the entry formula, like this…

NOT (entry formula)

In StrategyDesk, you can build a logical NOT like this..

(entry formula + 1) = 1

because, if conditions of the entry formula are met, 1+ 1 = 1 is false, otherwise 0 + 1 = 1. Sorry, here's the exit formula I came up with:

(
  { MACD Weakness Long Exit}

  MACD[Diff,Close,12,26,9,D,0,$COMPX] < MACD[Diff,Close,12,26,9,D,1,$COMPX]
  AND
  (
    MACD[Diff,Close,12,26,9,D,0,$COMPX] < 0
    OR
    MACD[Signal,Close,12,26,9,D,0,$COMPX] < 0
    OR
    ExpMovingAverage[EMA,Close,50,0,D,1,$COMPX] < ExpMovingAverage[EMA,Close,200,0,D,1,$COMPX]
    
  )
)

Now, plugging these two entry and exit rules into StrategyDesk and applying them on the 60 minute interval gives this backtesting result, with the buy and sell markers shown.

Looks pretty good doesn't it?

Click here for full chart
Posted Image

Well don't get too excited. Unfortunately, the results are misleading. StrategyDesk uses closing Daily bars for the trades, so the actual conditions for a buy and sell are tested at the daily close, while the bullish and bearish conditions reversed at some time during trading day. Perhaps you're making the same mistake by trading intraday based a Daily chart, only to find what looked bullish turned bearish by the close?

This is one very good reason why backtesting and forward testing can provide different results.

There is a way to rewrite these formulas so they show when the reversals actually happened; a topic for another day.

#2 borland

borland

    Member

  • Traders-Talk User
  • 276 posts

Posted 23 November 2008 - 07:41 PM

Lets see, the above chart shows the 60m MACD, while the backtest trades are based on the Daily MACD. What else, oh.... formulas are looking at the Nasdaq composite's MACD, while the trades are on the Q's.

#3 vitaminm

vitaminm

    Member

  • Traders-Talk User
  • 6,701 posts

Posted 23 November 2008 - 10:19 PM

To see this method working one may post buy/sell at real time!
vitaminm

#4 OEXCHAOS

OEXCHAOS

    Mark S. Young

  • Admin
  • 18,500 posts

Posted 25 November 2008 - 07:34 AM

MSS brought this topic to my attention. Very well done. I've pinned it prior to archiving it in Investors University.
Mark S Young
Wall Street Sentiment
Get a free trial here:
http://wallstreetsen...t.com/trial.htm
You can now follow me on twitter