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.
|
|
Registered User Joined: 1/7/2010 Posts: 11
|
I was looking for this as well I hope they do give a solution soon
|
|
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,632 time(s). MACD Negative Divergence.sfRuleRC - 7 KB, downloaded 1,069 time(s).
|
|
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
|
|
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 !!!
|
|
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.
|
|
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.
|
|
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
|
|
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?
|
|
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.
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
How did you go about creating the new condition? What steps did you take?
|
|
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
|
|
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.
|
|
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
|
|
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 ?
|
|
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.
|
|
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
|
|
Registered User Joined: 9/18/2008 Posts: 65
|
BruceThank you, That worked !!!
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
evanm,
You're welcome. Our pleasure.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
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
|
|
Registered User Joined: 9/18/2008 Posts: 65
|
Im still working on it, the solutions they gave wasnt great
|
|
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
By the way, all my work has been done in Stockfinder 4.
Kermitp
|
|
Guest-1 |