Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

macd peak or bottom Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
502beta
Posted : Friday, October 22, 2010 9:16:19 AM
Registered User
Joined: 11/29/2008
Posts: 5
I want to build a scan for assets whose MACD histogram has peaked or bottomed out.

That is, the highest positive histo bar is followe by a lower one  -  OR  - the lowest negative histo bar is followed by a higher one.

How do I write such a scan?
Bruce_L
Posted : Monday, October 25, 2010 8:49:03 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Welcome to the forums. A very good foundation for learning how to use TeleChart can be gained by reviewing the following:

If you are new to TeleChart READ THIS FIRST!

That would depend on your settings, but if we use an Exponential MACD 12,26,9 as an example, you could write a formula for the Histogram decreasing during the current Bar but having been both positive and increasing during the previous Bar as:

XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) < XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) AND XAVGC12.1 + XAVG(XAVGC26.1,9) > XAVGC26.1 + XAVG(XAVGC12.1,9) AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) > XAVGC12.2- XAVGC26.2 - XAVG(XAVGC12.2,9) + XAVG(XAVGC26.2,9)

A shorter but less intuitive way to write the same thing would be:

119 * C + 765 * XAVGC12.1 < 65 * XAVGC26.1 + 819 * XAVGC9.1 AND 3 * XAVGC26 + 14 * XAVGC9 > 17 * XAVGC12 AND 119 * C1 + 765 * XAVGC12.2 > 65 * XAVGC26.2 + 819 * XAVGC9.2

You could write a formula for the Histogram increasing during the current Bar but having been both negative and decreasing during the previous Bar as:

XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) > XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) AND XAVGC12.1 + XAVG(XAVGC26.1,9) < XAVGC26.1 + XAVG(XAVGC12.1,9) AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) < XAVGC12.2- XAVGC26.2 - XAVG(XAVGC12.2,9) + XAVG(XAVGC26.2,9)

A shorter but less intuitive way to write the same thing would be:

119 * C + 765 * XAVGC12.1 > 65 * XAVGC26.1 + 819 * XAVGC9.1 AND 3 * XAVGC26 + 14 * XAVGC9 < 17 * XAVGC12 AND 119 * C1 + 765 * XAVGC12.2 < 65 * XAVGC26.2 + 819 * XAVGC9.2

So a combined condition checking for either possibility could be written as either:

(XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) < XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) AND XAVGC12.1 + XAVG(XAVGC26.1,9) > XAVGC26.1 + XAVG(XAVGC12.1,9) AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) > XAVGC12.2- XAVGC26.2 - XAVG(XAVGC12.2,9) + XAVG(XAVGC26.2,9)) OR (XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) > XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) AND XAVGC12.1 + XAVG(XAVGC26.1,9) < XAVGC26.1 + XAVG(XAVGC12.1,9) AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) + XAVG(XAVGC26.1,9) < XAVGC12.2- XAVGC26.2 - XAVG(XAVGC12.2,9) + XAVG(XAVGC26.2,9))

Or as:

(119 * C + 765 * XAVGC12.1 < 65 * XAVGC26.1 + 819 * XAVGC9.1 AND 3 * XAVGC26 + 14 * XAVGC9 > 17 * XAVGC12 AND 119 * C1 + 765 * XAVGC12.2 > 65 * XAVGC26.2 + 819 * XAVGC9.2) OR (119 * C + 765 * XAVGC12.1 > 65 * XAVGC26.1 + 819 * XAVGC9.1 AND 3 * XAVGC26 + 14 * XAVGC9 < 17 * XAVGC12 AND 119 * C1 + 765 * XAVGC12.2 < 65 * XAVGC26.2 + 819 * XAVGC9.2)

How to create a Personal Criteria Forumula (PCF)
Understanding MACD
PCF Formula Descriptions
Cascades of Moving Averages
Handy PCF example formulas to help you learn the syntax of PCFs!

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
502beta
Posted : Monday, October 25, 2010 2:11:37 PM
Registered User
Joined: 11/29/2008
Posts: 5
I copied and pasted your formulas into the pcf window one by one and ran 'Test' on each. The result was the same every time "False".

Market days needed to calcualte criterion varied.

I use this formual to signal a turn up in the stochastic curve and it works. "STOC12.3 > STOC12.3.1 AND STOC12.3.1 < STOC12.3.2" 

Can I do the same thing with MACD histogram bars?
Bruce_L
Posted : Monday, October 25, 2010 2:13:24 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
The formulas work correctly as is.

False is not an error message. It just means the formula isn't True for the test symbol.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.