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

Notification

Icon
Error

Options
Go to last post Go to first unread
sgrsankar  
#1 Posted : Tuesday, May 30, 2006 1:51:07 PM(UTC)
sgrsankar

Rank: Newbie

Groups: Registered, Registered Users
Joined: 1/17/2006(UTC)
Posts: 7
Location: New delhi

I am a new user for Metastock/power pivots plus. I need help in programming PP+. I would like to create my own trading system using PP+. At any point of time, I would like to define Reward/Risk ratio something like (Upper resistance - Close price)/(Close price - Lower support) for Long trades 'Upper resistance' is a nearest pivot upside which can be minor/intermediate/Major/Primary and must be greather than Close price Similarly 'Lower support' is a nearest pivot downside which can be minor/intermediate/Major/Primary and must be less than Close price Now my problem is that when I try function for Upper resistance ExtFml("PowerPivots.NthPivotPrice",1,0,1) 1. I am getting price some times less than close price and 2. some times that minor pivot upside is grater than Intermediate pivot upside i.e. ExtFml("PowerPivots.NthPivotPrice",2,0,1) is becoming less than ExtFml("PowerPivots.NthPivotPrice",1,0,1) I wanted closest pivot(R/I/M/P) upside which is greater than Close Finally I wrote an indicator for the same as follows {myPP+ - Target long} CV:=C; HV:=Highest(C); P1:=If(ExtFml("PowerPivots.NthPivotPrice",4,0,1)>CV, ExtFml("PowerPivots.NthPivotPrice",4,0,1), HV); M1:=If(ExtFml("PowerPivots.NthPivotPrice",3,0,1)>CV, ExtFml("PowerPivots.NthPivotPrice",3,0,1), HV); I1:=If(ExtFml("PowerPivots.NthPivotPrice",2,0,1)>CV, ExtFml("PowerPivots.NthPivotPrice",2,0,1), HV); R1:=If(ExtFml("PowerPivots.NthPivotPrice",1,0,1)>CV, ExtFml("PowerPivots.NthPivotPrice",1,0,1), HV); D1:=IF(P1>M1, M1, P1); D2:=IF(D1>I1, I1, D1); D3:=IF(D2>R1, R1, D2); D4:=IF(D3=HV,-1,D3); D4; It does not apper to be working. Also when put in exploration the exploration is very slow. Is there any better way to write this indicator? Thanks in advance. Sankar
henry1224  
#2 Posted : Tuesday, May 30, 2006 10:47:11 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
you could try somthing like this A4:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=4),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=4),1,0)); A3:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=3),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=3),1,0)); A2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=2),1,0)); A1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=1),1,0)); B4:=If(A4=1,Highest(ValueWhen(1,A4=1,H)),0); B3:=If(A3=1,Highest(ValueWhen(1,A3=1,H)),0); B2:=If(A2=1,Highest(ValueWhen(1,A2=1,H)),0); B1:=If(A1=1,Highest(ValueWhen(1,A1=1,H)),0); If(Max(B4,Max(B3,Max(B2,B1)))-C>0,Neg(Max(B4,Max(B3,Max(B2,B1)))-C),0);
henry1224  
#3 Posted : Wednesday, May 31, 2006 11:19:02 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
henry1224  
#4 Posted : Wednesday, May 31, 2006 11:50:16 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
A4:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=4),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=4),1,0)); A3:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=3),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=3),1,0)); A2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=2),1,0)); A1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=1),1,0)); An4:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=-4),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=-4),1,0)); An3:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=-3),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=-3),1,0)); An2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=-2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=-2),1,0)); An1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=-1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=-1),1,0)); B4:=If(A4=1,Highest(ValueWhen(1,A4=1,H)),0); B3:=If(A3=1,Highest(ValueWhen(1,A3=1,H)),0); B2:=If(A2=1,Highest(ValueWhen(1,A2=1,H)),0); B1:=If(A1=1,Highest(ValueWhen(1,A1=1,H)),0); Bn4:=If(An4=1,Lowest(ValueWhen(1,An4=1,L)),0); Bn3:=If(An3=1,Lowest(ValueWhen(1,An3=1,L)),0); Bn2:=If(An2=1,Lowest(ValueWhen(1,An2=1,L)),0); Bn1:=If(An1=1,Lowest(ValueWhen(1,An1=1,L)),0); Hr:=Max(B4,Max(B3,Max(B2,B1))); Lr:=Min(Bn4,Min(Bn3,Min(Bn2,Bn1))); Sto1:=(C-Lr)/(Hr-Lr); Sto2:=(Hr-C)/(Hr-Lr); Sto1;Sto2;
henry1224  
#5 Posted : Thursday, June 1, 2006 12:01:31 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
this indicator only uses minor and intermediate pivots but it plotsthe same as the above indicator A2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=2),1,0)); A1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=1),1,0)); An2:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=-2),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=-2),1,0)); An1:=If(IsUndefined(ExtFml("PowerPivots.Pivots")=-1),0, If(IsDefined(ExtFml("PowerPivots.Pivots")=-1),1,0)); B2:=If(A2=1,Highest(ValueWhen(1,A2=1,H)),0); B1:=If(A1=1,Highest(ValueWhen(1,A1=1,H)),0); Bn2:=If(An2=1,Lowest(ValueWhen(1,An2=1,L)),0); Bn1:=If(An1=1,Lowest(ValueWhen(1,An1=1,L)),0); Hr:= Max(B2,B1); Lr:= Min(Bn2,Bn1); Sto1:=(C-Lr)/(Hr-Lr); Sto2:=(Hr-C)/(Hr-Lr); Sto1;Sto2;
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.