Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 10/25/2005(UTC) Posts: 7
|
Help requested developing a divergence indicator! The following is a rough divergence coding idea that seeks to improve on the publicly available ones so far that try to identify a divergence but that still needs a few tweaks to get it running smoothly.
The publicly available divergence screens so far based on zigzag and correlation leave much to be desired. They just don't seem to work very well. Those based on Metastock's native Zigzag function like Peak() and Trough() are commonly not timely because Metastock waits for a Zigzag to confirm first before it will calculate values for peak and trough so the values returned on publicly available divergence indicators based on them can lag quite severely.
Using an alternate approach to tackle divergence might be a solution. An idea that suggests itself is to compare the lowest values or highest values of two past periods using the LLV and HHV functions. A very rough version of a binary wave that might identify a MACD and price positive divergence then between a low in the last 10 bars with a low in the 11th to 20th past bars might be coded like this:
______________________________________________________________
{Positive MACD Divergence Based on LLV 10-10 (Experimental) created by Capablanca}
i:=MACD();
LLV(C, 10) < Ref(LLV(C, 10), -10)
AND
LLV(i, 10) > Ref(LLV(i, 10), -10)
AND
LLV(C, 10) < 1.05*Ref(LLV(C, 10), -10)
_______________________________________________________________
{Negative MACD Divergence Based on HHV 10-10 (Experimental) created by Capablanca}
i:=MACD();
HHV(C, 10) > Ref(HHV(C, 10), -10)
AND
HHV(i, 10) < Ref(HHV(i, 10), -10)
AND
HHV(C, 10) > 1.05*Ref(HHV(C, 10), -10)
_______________________________________________________________
In truth it has been a while since I last worked on the problem but from what I can remember the main difficulty before I moved on to work on other things was that I was having trouble determining the appropriate look back periods to compare and their length and also the appropriate retracement % between the extremes of the 2 compared time periods that would trigger the divergence setup. Looking at it now an approach I may take if I wish to develop this idea further is to use an adaptive cycle period function as found in the Hilbert.dll or the Homodyne function in the ASI.dll and perhaps use that in conjunction with either the LLV and HHV functions of the forum.dll or ASI.dll and substitute those for the regular LLV and HHV functions found above.
There may well be other weaknesses to this divergence indicator that I'm overlooking.
If anyone wants to work on this and develop it further please post any improvements you make. :)
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 8/1/2006(UTC) Posts: 1
|
I had the same idea some days ago but I was unable to work it out.
The basic concept of the LLV and the HHV remains the same but I tried something going back to my trigonometry classes in school...I hope someone could bring some ideas....
I tried to count the number os bars after the first HHV with the Barssince() function and do it again to the nearest HHV, subtract the two HHV to get the oposite cathetus. now I have the oposite and the adjacent cathetus, I calculate the hypotenuse and then the sine.
I do the same with de MACD histogram and then compare the signals of the sines to see if I have a divergence...
The problem is that I'm new to the metastock and I do not even know how to start programing this....
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
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.