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 |

Price vs MACD Divergences Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
evanm
Posted : Tuesday, January 26, 2010 6:26:53 PM
Registered User
Joined: 9/18/2008
Posts: 65
MACD to Price Divergence..Even though the ZigZag shows some divergences, its not exactly what I am looking forPlease click the link below and refer to this image:http://www.matzconsultinggroup.com/tmp/MACDDivergence2.jpgThis Stock (“VLO” Example) clearly shows a Divergences between the MACD (as well as the Stochastics).In the image I have drawn three divergences on the one stock.Notice the Dotted Lines drawn from one High Price to a Higher High Price and the corresponding MACD is a High MACD to a Lower High MACD, thus indicating our divergences.I would like the System to Scan and show when the Previous High MACD is Greater than the Current High MACD only when the Previous High Price is Lower Than the Current (last) High Price Thus showing NEGATIVE Divergences….I also tried to Write this as a Divergence with the LinearRegression Slope on both MACD & Price, it comes close but no cigar. Your help is greatly appreciated…Opposite would be true for Positive Divergences…Previous Lowest Low MACD is Less than the Current Low MACD only when the Corresponding Previous Lowest Low Price is Greater than the Current (Last) Low Price, thus showing Positive Divergence.
Rasean827
Posted : Wednesday, January 27, 2010 11:41:24 AM
Registered User
Joined: 1/7/2010
Posts: 11
I was looking for this as well I hope they do give a solution soon
StockGuy
Posted : Wednesday, January 27, 2010 12:12:23 PM

Administration

Joined: 9/30/2004
Posts: 9,187
You might need to tweak the period some but this found  two of bars you identified on VLO.  

'# MH = chart.MACDHistogram   -  this was added to the code by clicking on the MACD plot and dragging it into the editor.

A "bottled" version of the condition is attached which you can save and load directly into StockFinder.


Attachments:
pa44734.png - 95 KB, downloaded 2,636 time(s).
MACD Negative Divergence.sfRuleRC - 7 KB, downloaded 1,073 time(s).

evanm
Posted : Wednesday, January 27, 2010 12:37:43 PM
Registered User
Joined: 9/18/2008
Posts: 65
Thank you , it looks like what i want but... I downloaded the RUle but when opened it was blank So i typed in what you had shown in the image '# MH = indicator.MACDHistogram '# period = userinput.integer = 34 If price.High > price.MaxHigh(period, 1)AndAlso price.MaxHigh(period) > price.maxhigh(period, period) AndAlso mh.MaxHigh(period) < mh.MaxHigh(period, period) Then pass and i have the following errors: "If" must end with a matching "EndIf" Name 'period' is not declared. Expression Expected End of statement expected Please Advise Thank you in advance, Evan
evanm
Posted : Wednesday, January 27, 2010 12:40:28 PM
Registered User
Joined: 9/18/2008
Posts: 65
Wait, Im sorry, i found what i did wrong, i forgot the underscore at the end of the andalso _Now it worksTHank you !!!
StockGuy
Posted : Wednesday, January 27, 2010 12:42:34 PM

Administration

Joined: 9/30/2004
Posts: 9,187
Are you running StockFinder 4 or 5?

If 4, you'll have to create the rule from scratch.  Add Rule | Create in RealCode, then drag your MACD histogram plot into the code editor which will generate '# mh = chart.MACDHistogram.  

Then type in the line '# period =  userinput.integer = 34.

The type in the rest of the code beneath that so it looks exactly as pictured above.
StockGuy
Posted : Wednesday, January 27, 2010 1:04:07 PM

Administration

Joined: 9/30/2004
Posts: 9,187
QUOTE (evanm)
Wait, Im sorry, i found what i did wrong, i forgot the underscore at the end of the andalso _Now it worksTHank you !!!


You're welcome.
Rasean827
Posted : Wednesday, January 27, 2010 3:17:27 PM
Registered User
Joined: 1/7/2010
Posts: 11
what must be on the banner I cannot seem to get this to work no matter what I try
StockGuy
Posted : Wednesday, January 27, 2010 3:23:49 PM

Administration

Joined: 9/30/2004
Posts: 9,187
QUOTE (Rasean827)
what must be on the banner I cannot seem to get this to work no matter what I try


Banner?  What is that?
evanm
Posted : Wednesday, January 27, 2010 3:25:09 PM
Registered User
Joined: 9/18/2008
Posts: 65
The Negative Divergences for the MACD Histogram seem to work...I tried to create a Positive Divergence now but i am receiving error messages. Please help This is what i inputted to a new realcode.. If price.Low < price.MinLow(period, 1) AndAlso _ price.MinLow(period) < price.minlow(period, period) AndAlso _ mh.MinLow(period) < mh.MinLow(period, period) Then pass The two error messages i am getting are the following: 'Protected ReadOnly Property MH() As WBI.CommonBlocks ScriptingLine has multiple definitions with identical signatures. - & - Public Property MH_block() As WBI.Loki. CommonBlockDataTypes.DateLineSingle has multiple definitions with identical signatures.
StockGuy
Posted : Wednesday, January 27, 2010 3:41:12 PM

Administration

Joined: 9/30/2004
Posts: 9,187
How did you go about creating the new condition? What steps did you take?
evanm
Posted : Wednesday, January 27, 2010 3:48:50 PM
Registered User
Joined: 9/18/2008
Posts: 65
In addition to creating the Positive Divergence problem.... When I scan for the MACD Negative Divergence that you created, it goes into my Stockfinder 4.0 list to scan but it finds nothing and when i manually find a stock it does not display the color bubble inside the symbol on the leftsee pic at this link. http://www.matzconsultinggroup.com/tmp/NoBubbleScanIndication.jpg
evanm
Posted : Wednesday, January 27, 2010 3:56:34 PM
Registered User
Joined: 9/18/2008
Posts: 65
In creating the new condition these were my stops. 1. Add MACD HIstogram 2. Click Add Rule 3. Click in Real Code & Gave it a name 4. Click Indicator and select MACD Histogram 5. Inputted the following code: If price.Low < price.MinLow(period, 1) AndAlso _ price.MinLow(period) < price.minlow(period, period) AndAlso _ mh.MinLow(period) < mh.MinLow(period, period) Then pass Then The two error messages i am getting are the following: 'Protected ReadOnly Property MH() As WBI.CommonBlocks ScriptingLine has multiple definitions with identical signatures. - & - Public Property MH_block() As WBI.Loki. CommonBlockDataTypes.DateLineSingle has multiple definitions with identical signatures.
StockGuy
Posted : Wednesday, January 27, 2010 4:16:01 PM

Administration

Joined: 9/30/2004
Posts: 9,187

I can't reproduce the error in StockFinder 4.  Here's what the code should look like after you add the histogram using the Indicator/Rule button and put in the userinput statement.


'*********************************************
'* if Price.Close > Price.Close(1) then Pass *
'*********************************************
'# MH = indicator.MACDHistogram
'# Period = userinput.integer = 34

If price.Low < price.MinLow(period, 1) AndAlso _
 price.MinLow(period) < price.minlow(period, period) AndAlso _
 mh.MinLow(period) < mh.MinLow(period, period) Then pass

evanm
Posted : Wednesday, January 27, 2010 4:30:26 PM
Registered User
Joined: 9/18/2008
Posts: 65
Thank you now it works... I see what i did wrong... I left out the declared values.... But, the Scan for this still doesnt work... It will paint the bars but no scan produces any results... any thoughts ?
StockGuy
Posted : Wednesday, January 27, 2010 4:37:15 PM

Administration

Joined: 9/30/2004
Posts: 9,187
I'm not sure.  We've cleaned up a lot of the code in version 5 and, while we're still in beta, it's getting very close to release. I'd recommend installing version 5 and using that going forward.

Bruce_L
Posted : Wednesday, January 27, 2010 4:50:14 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
evanm,
The RealCode already seems to work just fine as a RealCode Condition in StockFinder 5, but adding the following line to the RealCode Rule seems to allow it to produce WatchList Lights in StockFinder 4:

'# Cumulative

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
evanm
Posted : Wednesday, January 27, 2010 4:58:39 PM
Registered User
Joined: 9/18/2008
Posts: 65
BruceThank you, That worked !!!
Bruce_L
Posted : Wednesday, January 27, 2010 5:10:28 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
evanm,
You're welcome. Our pleasure.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Fagerman
Posted : Sunday, April 25, 2010 12:27:55 PM
Registered User
Joined: 8/3/2009
Posts: 11
evanm - Did you ever get this resolved? I have been trying to find a way to use Stockfinder to scan for MACD to Price negative and positive divergences, but so far to no avail. If you have a script that works for this in Stockfinder, I would be extremely greatful for a copy.

Best,

Fagerman
evanm
Posted : Sunday, April 25, 2010 3:13:15 PM
Registered User
Joined: 9/18/2008
Posts: 65
Im still working on it, the solutions they gave wasnt great
Kermitp
Posted : Thursday, April 29, 2010 7:43:32 PM
Registered User
Joined: 10/7/2004
Posts: 364

 

I have read this discussion and I find it very interesting given that I have been working on about the same thing only using Stochastics. 

One of the questions I have been kicking around is –
 
What is and how does one determine the minimum difference that is required at the "Pivot" point in order to have a valid Divergence? 

I expect the value will be different for each indicator. There is some diffenence at each pivot point and that is why I think one needs to filter based on a minimum value.
 
Taking your example of VLO above: MACD 5,34,5 EXP

09/17/09 Price.High  =  21.10  MACD = 0.337
10/23/09 Price.High  =  21.78  MACD = 0.185 

The difference is 0.152 a very small number. Yet visually it is very easy to see due to the scaling.
But is difference of 0.001 enough to qualify as “Divergence”?
 
Using the STOC 12,3,3 simple
 
09/17/09 Price.High  =  21.10  STOC = 84.313
10/23/09 Price.High  =  21.78  STOC = 66.393 
A difference of 17.9 which is almost 1/5 of the scale of 0 – 100
 
 
In my limited testing I have not settle on what the minimum difference should be for the STOC. I have not tested the MACD at all. What I have found with the STOC is there are a lot more “Negative Divergences” than there are “Positive Divergences”. The negative do not seem to work nearly as well as the Positive divergence. Below is a screenshot of VLO doing the same time period you showed in earlier discussion. Screenshot link is  http://www.tradingourway.com/img/VLO-Divergence-10-23-09.gif   


Vlo Divergence


By the way, all my work has been done in Stockfinder 4. 

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