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 divergence scanner Topic Rating:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rassom
Posted : Friday, September 14, 2012 3:51:11 AM
Registered User
Joined: 3/18/2009
Posts: 61

Dear Worden trainer,

How would I go about scanning for divergences between price and MACD? Should I use PCF? If yes, would you help write a 2 PCFs - one that on a daily chart scans for divergences in price and MACD Histogram and one that scans for divergences in price and MACD Lines.

Thanks :)

Bruce_L
Posted : Friday, September 14, 2012 8:21:27 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You would start by creating an unambiguous objective definition of the MACD divergence you are attempting to identify. Searching the forums for MACD Divergence will identify numerous different definitions and varying degrees of success. Many (possibly even most) definitions would result in a formula which is too long and slow to be practical or post in the forums.

Let's start with a fairly simple way to search for a divergence between Price History and a MACD Histogram over the most recent 10-bars.

Click on Price History and select Create Scan Condition. Then select Moving Up from the Condition drop-down menu (Net, % or Smart would do). Then set the Period of the Condition to the number of bars over which you wish to check for a divergence (in this case, 10).

Creating Scan and Sort Conditions

Then do the same thing with the MACD Histogram indicator, but choose Moving Down instead of Moving Up.

You can then add both the Conditions to the same EasyScan. Checking for a divergence where Price History was Moving Down and the MACD Histogram was Moving Up would just be a matter of switching around how you created the Conditions and checking for MACD instead of the MACD Histogram would just be a matter of substituting MACD for MACD Histogram in the instructions.

EasyScan Basics
EasyScan Expanded



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
pmdtrading
Posted : Tuesday, November 6, 2012 3:29:52 PM
Registered User
Joined: 11/1/2012
Posts: 13

What if instead of looking for a divergence between, say, falling price and rising MACD, I want to scan for a new x-day price low which corresponds to a higher low in MACD histogram?  How would I create that condition for scanning purposes?

 

Bruce_L
Posted : Tuesday, November 6, 2012 3:40:14 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I do not know of a way to create a Condition Formula for this which would be short enough to be practical.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rwebster
Posted : Sunday, November 11, 2012 3:37:57 PM
Registered User
Joined: 1/29/2005
Posts: 1

MACD Histogram.  How would I write the condition that the MACD Histogram is positive 5 days ago?  Negative 5 days ago?

Bruce_L
Posted : Monday, November 12, 2012 10:18:28 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The easy way to do this without even having to know the setting of the MACD Histogram in TC2000 version 12.2 is to add a 1-Period Simple Moving Average with an Offset of 5 to the MACD Histogram. You can then click on the moving average instead of the MACD and select Create Scan Condition to create a Condition.

Creating Scan and Sort Conditions

It is also possible to create a Condition Formula for this if the settings are known. For example, a Condition Formula for the Exponential MACD Histogram 12,26,9 being above zero 5-bars ago could be written as:

XAVGC12.5 + XAVG(XAVGC26.5,9) > XAVGC26.5 + XAVG(XAVGC12.5,9)

While A Condition Formula for being below zero would be:

XAVGC12.5 + XAVG(XAVGC26.5,9) < XAVGC26.5 + XAVG(XAVGC12.5,9)

Understanding MACD
Personal Criteria Formula Conditions
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Monday, November 12, 2012 11:41:03 AM
Registered User
Joined: 10/7/2004
Posts: 1,006

Bruce, which PCF is the best math efficient to use for the,

Exponential MACD Histogram 12,26,9 being Above / Below 0

 

Above 0, 5 Periods Ago

(XAVGC12.5 - XAVGC26.5) - (XAVG(XAVGC12.5,9) - XAVG(XAVGC26.5,9)) >0  

XAVGC12.5 + XAVG(XAVGC26.5,9) > XAVGC26.5 + XAVG(XAVGC12.5,9)

 

Below 0, 5 Periods Ago

(XAVGC12.5 - XAVGC26.5) - (XAVG(XAVGC12.5,9) - XAVG(XAVGC26.5,9)) <0

XAVGC12.5 + XAVG(XAVGC26.5,9) < XAVGC26.5 + XAVG(XAVGC12.5,9)

 

Thanks,

Winnie

Bruce_L
Posted : Monday, November 12, 2012 11:45:17 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

It doesn't matter. They will return the same results. I just posted the version I did because it was shorter while still being relatively intuitive.

It is possible to create an even shorter version using the techniques given in the Cascades of Moving Averages topic, but the resulting formula is not obvious. The above 5-bars ago version would be:

3 * XAVGC26.5 + 14 * XAVGC9.5 > 17 * XAVGC12.5

And the below 5-bars ago version would be:

3 * XAVGC26.5 + 14 * XAVGC9.5 < 17 * XAVGC12.5

Since it doesn't take an exponential moving average of an exponential moving average, it should not only be shorter, but more efficient than the other versions as well. That said, providing it as an example does not necessarily allow other people reading the topic later to create similar formulas.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Winnie
Posted : Monday, November 12, 2012 12:19:45 PM
Registered User
Joined: 10/7/2004
Posts: 1,006

Bruce, I find it interesting writing PCF's various ways with the same result values.

Again thanks, appreciate your knowledge, insight and sharing this with us,

Winnie

bknight
Posted : Saturday, January 5, 2013 9:49:57 AM
Registered User
Joined: 12/19/2004
Posts: 415

With the above thoughts how could one write a pcf for MACD 5 days ago be GT MACD 22 days ago with low price 5 days ago LT low 22 days ago?  The 5 and 22 are just examples, as I'm really trying to find those divergences from market low to market low and what ever those specific intervals would be.

Bruce_L
Posted : Monday, January 7, 2013 9:10:22 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Assuming we are still interested in the MACD Histogram 12,26,9, your formula could be written as:

3 * XAVGC26.5 + 14 * XAVGC9.5 - 17 * XAVGC12.5 > 3 * XAVGC26.22 + 14 * XAVGC9.22 - 17 * XAVGC12.22 AND L5 < L22

Don't let the relative simplicity of this formula fool you however. Your eventual goal would seem to be trying to identify to two most recent local minima (lows) of either price or the MACD and then checking for opposite slopes between those two points. This is far more complicated and results in formulas which end up being too long to be practical or post in the forums.

You can find the most recent local minima using the techniques given in the Days Since Last Peak (or other day-counting needs) topic, but identifying the local minima prior to that requires using the more complicated technique given in the PCF for Order Statistics topic.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
drbouare
Posted : Thursday, June 4, 2015 12:45:16 PM
Registered User
Joined: 6/4/2015
Posts: 1

Hi,How can I add in backtesting report for MACD divergence software  to TC 2000? as it was possible with stock finder before.

Bruce_L
Posted : Thursday, June 4, 2015 1:35:55 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

When you say it was possible in StockFinder previously, do you have a specific example of the type of BackScan which did what you want in StockFinder?

The following SF related topic has links to several possible options along with a discussion about trying to create something more complex (which did not result in any working conditions).

MACD Divergence scanner

StockFinder is going to be better suited to identifying more complex patterns because it has a full programming language, but they still need to be objectively defined. Some of the simpler algorithms might be able to be implemented in TC2000.

TC2000 does not have any built in backtesting features, so if you need that, you want want to go with StockFinder since it has BackScanner.

I would generally recommend TC2000 over StockFinder if TC2000 can do what you want as it is a newer program still in development.



-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.