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

Notification

Icon
Error

Options
Go to last post Go to first unread
ketal  
#1 Posted : Wednesday, March 29, 2017 5:32:58 AM(UTC)
ketal

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/7/2014(UTC)
Posts: 17

Thanks: 6 times
Hi, I am trying to code for bar highlight for pivot on the basis of the close. following are the conditions a) Low pivot (LP) 1) LP must close lower than previous 2 bars close ie close of bar -1 and close of bar -2. the two closes do not have to be in consecutive order. I have coded- C>REF(C,-1) AND C>REF(C,-2) 2) bar +1 close must be equal or > LP close I have coded- C>=REF(C,1) 3) LP is confirmed as LP bar(s) next to +1 bar closes equal to of > +1 bar close. it may be +2 bar or +3 bar or any bar as long as there is no close below LP bar close as its void the sequence.  Here I am not able to do the code- please help me.  for High Pivot (HP) reverse the conditions. Regards, K
wabbit  
#2 Posted : Wednesday, March 29, 2017 1:58:41 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)

It's late, I'm tired, your code doesn't match your words, so here goes....

Code:

lpBarPlus1:=
Ref(C,-1) < Ref(C,-2) AND
Ref(C,-1) < Ref(C,-3) AND
Ref(C,-1) <=C;

lpBarPlus1Close:=ValueWhen(1,lpBarPlus1,C);

count:=Cum(C>lpBarPlus1Close);
counter:=count-ValueWhen(1,lpBarPlus1,count);

confirmation:=counter=1 AND Alert(counter<>1,2);

{plot}
confirmation;

Edited by user Thursday, April 20, 2017 8:47:45 AM(UTC)  | Reason: Fixed code tags

thanks 1 user thanked wabbit for this useful post.
ketal on 4/3/2017(UTC)
ketal  
#3 Posted : Monday, April 3, 2017 8:17:37 AM(UTC)
ketal

Rank: Member

Groups: Registered, Registered Users, Unverified Users
Joined: 3/7/2014(UTC)
Posts: 17

Thanks: 6 times
Hi, I am sorry not able to make my self understand properly. The above code is not the one I am looking for. I have made the semantics for both high pivot and low pivot. Kindly look at it and plz help. http://i.imgur.com/T0O24jW.png http://i.imgur.com/954Qspo.png
wabbit  
#4 Posted : Monday, April 3, 2017 4:35:38 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Because you could have multiple instances where the LP condition is true whilst awaiting confirmation, the only real solution is leave the limited metastock formula language behind and use an external function written in a far more powerful language.
thanks 1 user thanked wabbit for this useful post.
ketal on 4/3/2017(UTC)
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.