logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Patrick  
#1 Posted : Tuesday, May 31, 2005 5:11:29 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Alright this is a short one 17 minutes or so. It is about divergence. It show you how to use the valuewhen function while quickly showing the Stochastic and Rsi functions. http://forum.equis.com/Training/FormulaTraining/Lesson3.htmliting later.
billtrudeau  
#2 Posted : Wednesday, June 1, 2005 1:42:58 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Thanks for training session on divergence. Is there some book, other than the formula primer, that explains the various programming techniques. For example, there is one section of the code in Jose's formula that you were not sure about. He obviously did not invent that, it must be part of the programming language that MetaStock uses. Is there some reference that you can recommend. Thanks.
Patrick  
#3 Posted : Wednesday, June 1, 2005 2:14:51 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
The input I was not sure about was : shift:=Input("Shift signals back to match divergences=1",0,1,0); It is used in the last line o code as part of the condition. Ref(Trx AND Try AND Trx1<Trx2 AND Try1>Try2,shift) -Ref((Pkx AND Pky AND Pkx1>Pkx2 AND Pky1<Pky2),shift) I did not look at Jose's formula prior to recording the lesson so I was a little confused as to what a ref(condition,0)-Ref(condition,0) or a ref(condition,1)-Ref(condition,1) would do. It allows you to select if you want the signal plotted on the trough or the peak or on the next bar ... Patrick :mrgreen:
billtrudeau  
#4 Posted : Wednesday, June 8, 2005 11:53:00 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Patrick, thanks for the reply and the thought provoking training sessions. I must say that when I first read the Formula Primer many moons ago, I thought that the manual was pretty basic and did not pay sufficient attention to it. After re-reading the Primer and tackling some of the formulas posted here, I am beginning to understand some of the subtleties of the language. Understanding what is understood by the language when writing formulas is essential. Looking at the many divergence formulas that I have found, I find that none of the formulas matches the divergences that I draw on the charts. One of the issues has to do with the fact that the peaks and troughs do not occur on the same dates, but some slight time difference apart. What I would like to do is to find a peak on the indicator and then find the last peak that was higher than the first peak. Once that is done I would see if the slope of the line connecting the price bars that occurred on the dates when the indicator peaked is diverging from the slope of the line connecting the indicator peaks. The same approach would apply to the troughs. I might add another qualifier to the indicator peak that would weed out any peaks that happened below the indicator trigger line, if there is one. I find that if the peak occurs above the trigger line it improves the method results. I have not seen any divergence formulas with this approach. Since you have developed many divergence formulas for clients in the past, have you used or seen an approach as I have described?
Patrick  
#5 Posted : Thursday, June 9, 2005 4:29:45 AM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
I guess you could use some of the ideas of a cup and handle formula,combine it with wecoyote13's request from earlier and do something like : {for peak} Adjust:=Input("Enter Adjustment periods",1,100,6); AdjustConstant:=(adjust/2); Ind1:=Stoch(14,3); Ind2:=C; T1:=Peak(1,Ind1,15); CD:=T1<>Ref(T1,-1); I1:=ValueWhen(1,Cross(BarsSince(Cd),AdjustConstant),HHV(Ind1,Adjust)); I2:=ValueWhen(2,Cross(BarsSince(Cd),AdjustConstant),HHV(Ind1,Adjust)); C1:=ValueWhen(1,Cross(BarsSince(Cd),AdjustConstant),Cum(1)); C2:=ValueWhen(2,Cross(BarsSince(Cd),AdjustConstant),Cum(1)); P1:=ValueWhen(1,Cum(1)=C1,Ind2); P2:=ValueWhen(2,Cum(1)=C2,Ind2); I1>I2 and P1<P2 Adjust is for us to check the highest value or lowest value of X at the time of the peak or the trough for "Adjust" amont of bars. We divide it by 2 to evenly extent the Adjust values on both sides. Then we count the number of bars till the inidcator value we picked adn matched this number of bars to retrieve our price value or second indicator value ... A little confusing :D I might have made a mistake but that should be a decent start Patrick
s1nbad  
#6 Posted : Friday, June 10, 2005 9:27:01 AM(UTC)
s1nbad

Rank: Member

Groups: Registered, Registered Users
Joined: 5/31/2005(UTC)
Posts: 27
Location: sydney

Thanks for the lesson, Patrick. Unfortunately most of it goes over my head. I'm thankful that there is someone like yourself prepared to take the time to make these lessons available to the rest of us. Good on ya Patrick. :D
billtrudeau  
#7 Posted : Saturday, June 11, 2005 5:47:54 PM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Hi Patrick, I am trying to understand how the formula that you posted works, and I am using the opposite method demonstrated in the Formula Primer. That is I am trying to write in English what each line of your formula does. I started this approach because the formula does not plot values and I am trying to figure out why. I plotted each line of the formula separately and got a plot for each part but the line for P2. Since P2 did not plot, neither did the last line of the formula. I am going to work on the formula this weekend and hope to either have a solution or enter a reply indicating what I think each line of code represents so that I can get some feedback about my interpretation. Thanks, Bill
billtrudeau  
#8 Posted : Monday, June 13, 2005 1:35:42 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Well, I played around with this formula and tried some other approaches but nothing yet, may be impossible to get divergences programmed into MetaStock to the point where it duplicates visual observations. Something is wrong with the formula as shown. I changed the occurrence to 1, from 2, in the formula for P2 and got the indicator to plot. Not sure if this is the proper fix. Going to continue to work on this as I would like to get an Explorer and Expert that comes close to nailing the type of divergence patterns that interest me.
billtrudeau  
#9 Posted : Sunday, June 19, 2005 12:48:40 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

Also, for a peak, shouldn't I1<I2 and P1>P2 ?
rsarin  
#10 Posted : Sunday, June 19, 2005 11:33:09 AM(UTC)
rsarin

Rank: Newbie

Groups: Registered, Registered Users
Joined: 6/18/2005(UTC)
Posts: 1

Dear Patrick, I am new to this forum as well as to Metastock. However, after listening to your first two videos, I have learnt the basics and trying to experiment in Metastock. In actual practice, what is your experience of success of various indicators. Can you list promising ones, having higher success rate. Thanking You rsarin :roll:
Patrick  
#11 Posted : Sunday, June 19, 2005 3:10:38 PM(UTC)
Patrick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 9/8/2004(UTC)
Posts: 2,266

Was thanked: 1 time(s) in 1 post(s)
Hi Rsarin, I could tell that a zero moving average is the best indicator, but them you would test it against your portfolio and if it is not good, you will think that I'm just a liar or that I don't know what I'm talking about :D Here is what I wrote a while back, I think it applies :
yeah I will call it {your name here}'s plug in and sell it for gold" Creating your own plug-in ( We are really talking about creating your own system ), will actually make you study it as you develop it. As you are testing it, you will learn how it reacts to different markets, to different trends. As you find its short comings you will learn its personnality and train yourself to recognize these red flags ... [/quote wrote:
Patrick :mrgreen:
billtrudeau  
#12 Posted : Friday, July 29, 2005 1:54:57 AM(UTC)
billtrudeau

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 4/27/2005(UTC)
Posts: 132
Location: Manchester, NH

In trying to write the formula for divergence, I have found that the best way, and I have tried many different ways so far, to test for divergences is to check to see if there is a divergence of the price on the days that two peaks or troughs were made. I first test today's peak/trough with the last peak/trough and then test today's peak/trough with the second most recent peak/trough and then today's peak/trough with the third most recent peak/trough and so on until I tested as many as I want to write the formula code for. There might be a divergence of today's peak/trough with the tenth most recent peak/trough. Is there a way in MetaStock to write a loop, so that from i=1 to 20, or some other number, I can write the formula once with a variable, i, that will check today's peak/trough with the previous 20 occurences? This would make the formula a lot simpler and easier to edit. If it can't be done in MetaStock but could be done in a DLL, how could I learn to write a DLL? Thanks, Bill
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.