Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Finding and Ranking Divergences, Visually Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Tanstaafl
Posted : Thursday, March 3, 2005 7:59:12 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Overview
I've written several other articles about various "nitty gritty" and "theoretical" aspects of divergences. This one is intended to be a straightforward "how to" that uses TC's Linear Regression lines and nifty SortBy functions. I will do this in two parts:
1) Explain (briefly) what Divergences are, and describe how to find them quickly in TC
2) Provide a way to segregate those Divergences into strong/weak and early/late categories


Background & Definitions
The idea behind divergences is that the recent trend of an Indicator can provide an "early warning" that the recent trend of the Price is about to change. That is, the Indicator's trend "leads" the Price's trend. There are a variety of ways to evaluate trends related to divergences - in TC, the easiest and most effective method is to apply a Linear Regression "best fit" line to the price and the indicator, and then compare the slopes of the two. This is different than the classic method of drawing the lines between succesive peaks or valleys ... but the LinReg method can be AUTOMATED, which saves a bunch of time.

If the Indicator's LinReg line slopes UP when the Price's LinReg line slopes DOWN (or is flat), that's a POSITIVE DIVERGENCE, so-called since the indicator is "predicting" a positive change in slope. If the Indicator's LinReg slopes down when the Price's LinReg slopes up (or is flat), it's a NEGATIVE divergence, anticipating a downward trend in prices.

Linear Regression lines have two input parameters that we will use for this: "periods" and "extension". PERIODS (required) denote how many bars are used to calculate the line, and how "wide" the line is along the timeline of the chart (a typical periods value might be 20). The EXTENSION input is optional - the LinReg line is "anchored to" and drawn backwards from the most recent day with a zero input, while an input of 10 "pushes" that line to the left (into the past), and tells TC to anchor the calc and the plot to a group of bars that ends ten bars ago.


Tasks to be Accomplished
OK ... that's plenty of general info to set the stage. Let's get started. First, we will set up the chart to identify the divergence of Prices with an indicator ... let's arbitrarily pick the 12,26 MACD Indicator as a starting point - you can use this method with ANY native TC indicator or with any Custom Indicator that you might come up with. Our method will be to isolate the stocks from a starting-point watchlist which show a Positive divergence into a separate watchlist, so that we can easily work with them further without losing track of which ones were diverging. After that, we will explain how to (optionally) break up those "hits" into two other subgroups (separate lists), one with just "recently diverging" symbols, and the other with "established divergences".

First Stage - Find Symbols with a Postive Divergence
1) Bring up your starting Watchlist, Unflag all in System, and make sure the Sort column is visible
2) Plot two "child" LinReg lines, on Price and on the Indicator, with equal Periods and Extension=0
3) Right click on the INDICATOR's LinReg line and do a SortBy Visual-Slope for the full Watchlist
4) Flag all symbols that report a POSITIVE slope of the Indicator's line in the Sort column
5) Right click on the PRICE's LinReg line and do a SortBy Visual-Slope for the full Watchlist
6) UN-FLAG all symbols in the Watchlist that have a POSITIVE Price slope in the Sort column
7) Save the remaining flagged symbols in a new watchlist, "All PosDiverg's"

Second Stage - Find Symbols that Just Started to Positively Diverge
If you would like to further "cull" this list to find just those stocks which have recently started to diverge, then REPEAT the first SIX steps above, starting from your All PosDiverg's watchlist, but in step 2, use a NONZERO Extension of about half the LinReg Periods (i.e. 10 bars if the Periods is 20 bars). At the end of step seven, you will have a second watchlist that holds symbols with postive divergences as of ten days ago. Those symbols will be flagged at the end of step six. Now, do the following to find the symbols which have just started diverging:
a) COPY All Symbols to a new watchlist, "New PosDiverg's", and SWITCH to that new list
b) REMOVE all FLAGGED symbols from that watchlist - remaining symbols are "just getting started"

Third Stage - Find Symbols that have Established Positive Divergences
One more perspective that might help is to figure out which of the "All PosDiverg's" stocks have "reliable" divergences - i.e. ones that are well established - the word "strong" is a bit misleading ... we are NOT looking at how "steep" the slopes are on the chart, or in the sort column ... a long explanation could be given as to why, but the bottom line is that "steepness" is NOT a reliable measure since the scales of the price and the indicator are different from each other, and are different for different symbols and zooms, etc. So, to find "established" divergences, REPEAT the first SIX steps again, but this time in step 2 you should DOUBLE the Period (i.e. 2x20=40 bars) of the LinReg lines, and keep the Extension set to zero. This gives a "longer term" evaluation of positive divergence. The stocks that satisfy this criterion will be flagged at the end of step six. Save the FLAGGED symbols to a new watchlist "Estab PosDiverg's"

Finding NEGATIVE Divergences ...
If you want to do the same thing for NEGATIVE divergences (to help find the end of a bull run or start of a bear run), do everything above in the same way, EXCEPT for steps 5 and 6 ... replace the word "Positive" with "Negative" in those instructions (and of course name your Watchlists differently).

That's it. You've got several sets of useful results here, without requiring a single PCF or EasyScan! For the record, it IS possible to build the entire one, two or three-stage culling process into a single complex PCF that yields the same results ... but that's way beyond the scope of this article!

Jim Dean

Additional Setup Info
TC bases its LinReg calculations on the Closing price, and you cannot change that ... but the Close that it uses is based on the Bar length that you have chosen. That is, the slope of a LinReg line that covers one month of time on a daily-bar chart (i.e. about 20 bars) will be DIFFERENT than the slope of a LinReg line that covers one month of time on a weekly-bar chart (i.e. about 4 bars). So, it's important to pick your displayed bar-lengths appropriately for your typical trading style. As a starting point, I suggest that you set the Periods of the LinReg to be equal to the number of bars in your typical hold time. You might want to read the article "Selecting Bar Lengths and Zoom Factors" to help you evaluate these issues.

Copyright 2005, James D. Dean - All Rights Reserved



Tanstaafl
Posted : Thursday, March 3, 2005 8:02:56 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
There are two other articles I've posted in the Worden Forum that deal with more detailed and theoretical Divergence issues, which might be interesting to advanced users:

Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis

Useful Gradations for Divergence Evaluations

Jim Dean

Craig_S
Posted : Friday, March 4, 2005 9:18:21 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
Isolating stocks based on how their linear regression lines compare on one item versus another deserves a video. I will get one made and posted in the next few business days.

- Craig
Here to Help!
Tanstaafl
Posted : Friday, March 4, 2005 10:02:03 AM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
If you are going to do a video of this, please ALSO direct them to this writeup .. AFAIK I was the originator of this systematic method for evaluating divergences - which I have published elsewhere in several forms as much as two years ago. Thus the copyright. I am happy to share with the community, but "credit where credit is due" should apply here.

Thank you.

Jim Dean

PeterWorden
Posted : Friday, March 4, 2005 3:13:14 PM

Administration

Joined: 10/7/2004
Posts: 31
This "systematic method" is not only not copyrightable it is not original. We have been applying LR lines to MoneyStream and price and comparing the two for many years.
Tanstaafl
Posted : Friday, March 4, 2005 3:36:20 PM
Registered User
Joined: 10/7/2004
Posts: 799
Location: Duluth, GA
Aha. Well, I have never seen anything in print or any other form which describes the ranking approach that I have described in detail. I realize that you have been using LR lines with MS. The unique thing that I have added is the second and third phase descriptions shown above, which provide significant and useful additional discrimination to the LR divergence hits. Are you claiming to have been teaching and promoting THAT as well?

ANY form of communication, if original, can be copyrighted by the author, simply by marking it appropriately. The text that I posted *is* protected by Federal copyright laws, unless it can be shown that I have "cribbed" it from some other source.

I agree that the copyright does not protect the ideas ... only the TEXT. Protection of ideas (or formulae) requires a concept-patent, which is difficult and expensive to obtain. For example, if someone were to figure out the math behind the TSV or MS or BOP simply by observation and experimentation, they could freely publish that info, even tho W *wants* it to be kept proprietary. I have respected W in this way ... I just expected reciprocal treatment.

It does no harm and costs you nothing at all, to say *thank you* to people when they come up with new ideas to help you. It does no harm to give them credit for adding to the body of knowledge that already exists.

Jim Dean

danclark
Posted : Thursday, April 14, 2005 12:58:44 PM
Registered User
Joined: 3/31/2005
Posts: 29
Jim,

These are excellent concepts. Perhaps others should have already said it, but at least I will:

Thank You!

Regards,

Dan.
Craig_S
Posted : Thursday, April 14, 2005 1:21:36 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
Here is the promised video:

Using Linear Regression Sorts to Help Spot Divergences

- Craig
Here to Help!
danclark
Posted : Thursday, April 14, 2005 2:01:34 PM
Registered User
Joined: 3/31/2005
Posts: 29
Craig,

My apologies... I should have complimented you too. The video clearly describes Jim's approach and greatly helped in understanding the systemic process. It is EXCELLENT!

Regards,

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