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

Notification

Icon
Error

Options
Go to last post Go to first unread
Spaceant  
#1 Posted : Wednesday, December 13, 2006 2:55:21 AM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

Can anyone help me in coding the captioned? I try to code two kind of entries and with two exit respectively:-

LB:=BBandBot(Typ(),20,S,2);

UB:=BBandTop(Typ(),20,S,2);

BY:=C<UB AND Ref(C<UB,-4) AND Sum(C>UB,4)<=3 AND Sum(C>UB,4)>=1;

SL:=C>LB AND Ref(C>LB,-4) AND Sum(C<LB,4)<=3 AND Sum(C<LB,4)>=1;

StopLE:=BarsSince(SL)<=5 AND C>=Ref(HHV(H,10),-1);

StopSE:=BarsSince(BY)<=5 AND C<=Ref(LLV(L,10),-1);

LE:=BY AND Alert(BY=0,2) OR StopLE;

SE:=SL AND Alert(SL=0,2) OR StopSE;

FilSTPUp:= CONDITION1;

FilSTPDn:= CONDITION2;

LX:=Cross(HHV(H – 2.5*ATR(5),10), C ) OR (1-FilSTPUp) AND H>=UB;

SX:=Cross(C, LLV(L + 2.5*ATR(5),10)) OR (1- FilSTPDn) AND L <=LB;

Tr:=ExtFml("Forum.Latch",LE, LX, SE, SX);

Tr

Use the long trade as an example, when long is triggered by "BY", the LX is to be based on H>=UB. When the long trade is triggered by "StopLE", the LX is to be based on Cross(HHV(H – 2.5*ATR(5),10), C ), not H>=UB .

Similarly, when the short trade is triggered by "SL", SX is to be based on L <=LB. When the short trade is tiggered by "StopSE", the SX is to be based on Cross(C, LLV(L + 2.5*ATR(5),10)), not L<=LB.

I am trying to use two filters, but I can't fix it. Can anyone help me please?

Sa

p/s please see the attached image for the explanation

UserPostedImage

Spaceant  
#2 Posted : Thursday, December 14, 2006 12:40:41 AM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

...Do I need to use the function of Count and Reset that Wabbit has mentioned earlier?

Need some help here.

Sa

Spaceant  
#3 Posted : Monday, December 18, 2006 9:04:04 AM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

Anyone could help me coding this?.....sa
Spaceant  
#4 Posted : Tuesday, December 19, 2006 7:29:53 PM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

could anyone please help me to fix it?...... I know that it is not difficult, but just beyond the knowledge that I have on Ms coding.

Thanks in advance!

Sa

minnamor  
#5 Posted : Tuesday, December 19, 2006 8:52:13 PM(UTC)
minnamor

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/27/2005(UTC)
Posts: 126
Location: Italy

Does this come close to your results?

Plot:=Input("[1] sys1,[2] sys2,[3] sys",1,3,1);

LE1:= C<BBANDTOP(TYP(),20,S,2) AND Ref(C<BBANDTOP(TYP(),20,S,2) ,-4) AND Sum(C>BBANDTOP(TYP(),20,S,2) ,4)<=3 AND Sum(C>BBANDTOP(TYP(),20,S,2) ,4)>=1;;
SE1:= C>BBANDBOT(TYP(),20,S,2) AND Ref(C>BBANDBOT(TYP(),20,S,2) ,-4) AND Sum(C<BBANDBOT(TYP(),20,S,2) ,4)<=3 AND Sum(C<BBANDBOT(TYP(),20,S,2) ,4)>=1;
LX1:= H>=BBANDTOP(TYP(),20,S,2) ;
SX1:= L<=BBANDBOT(TYP(),20,S,2) ;

B1:=ExtFml("PowerPivots.SysEval",LE1,LX1,SE1,SX1,"!@#$#@!");
State1:=If(B1>0,1,If(B1<0,-1,0));

LE2:= BarsSince(SE1)<=5 AND C>=Ref(HHV(H,10),-1);
SE2:= BarsSince(LE1)<=5 AND C<=Ref(LLV(L,10),-1);
LX2:= Cross(HHV(H-2.5*ATR(5),10), C );
SX2:= Cross(C, LLV(L+2.5*ATR(5),10));

B2:=ExtFml("PowerPivots.SysEval",LE2,LX2,SE2,SX2,"!@#$#@!");
State2:=If(B2>0,1,If(B2<0,-1,0));

LE:= LE1 OR LE2;
SE:= SE1 OR SE2;
LX:= If(BarsSince(LE1)>BarsSince(LE2),LX1,LX2);
SX:= If(BarsSince(SE1)>BarsSince(SE2),SX1,SX2);

B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
State:=If(B>0,1,If(B<0,-1,0));
If(Plot=1,state1,if(Plot=2,state2,State))

Spaceant  
#6 Posted : Wednesday, December 20, 2006 9:49:15 AM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

minnamor wrote:

Does this come close to your results?

Plot:=Input("[1] sys1,[2] sys2,[3] sys",1,3,1);

LE1:= C<BBANDTOP(TYP(),20,S,2) AND Ref(C<BBANDTOP(TYP(),20,S,2) ,-4) AND Sum(C>BBANDTOP(TYP(),20,S,2) ,4)<=3 AND Sum(C>BBANDTOP(TYP(),20,S,2) ,4)>=1;;
SE1:= C>BBANDBOT(TYP(),20,S,2) AND Ref(C>BBANDBOT(TYP(),20,S,2) ,-4) AND Sum(C<BBANDBOT(TYP(),20,S,2) ,4)<=3 AND Sum(C<BBANDBOT(TYP(),20,S,2) ,4)>=1;
LX1:= H>=BBANDTOP(TYP(),20,S,2) ;
SX1:= L<=BBANDBOT(TYP(),20,S,2) ;

B1:=ExtFml("PowerPivots.SysEval",LE1,LX1,SE1,SX1,"!@#$#@!");
State1:=If(B1>0,1,If(B1<0,-1,0));

LE2:= BarsSince(SE1)<=5 AND C>=Ref(HHV(H,10),-1);
SE2:= BarsSince(LE1)<=5 AND C<=Ref(LLV(L,10),-1);
LX2:= Cross(HHV(H-2.5*ATR(5),10), C );
SX2:= Cross(C, LLV(L+2.5*ATR(5),10));

B2:=ExtFml("PowerPivots.SysEval",LE2,LX2,SE2,SX2,"!@#$#@!");
State2:=If(B2>0,1,If(B2<0,-1,0));

LE:= LE1 OR LE2;
SE:= SE1 OR SE2;
LX:= If(BarsSince(LE1)>BarsSince(LE2),LX1,LX2);
SX:= If(BarsSince(SE1)>BarsSince(SE2),SX1,SX2);

B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
State:=If(B>0,1,If(B<0,-1,0));
If(Plot=1,state1,if(Plot=2,state2,State))

Thanks for your work, I will try it when I am back from a short holiday from Thailand. BTY, can I use Forum Latch instead of PP+?

Sa

Spaceant  
#7 Posted : Friday, February 16, 2007 5:33:04 PM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

I have tried minamor's code, but it isn't what I want.

Could anyone kind enough to help me coding what I want, see the top first message of this thread?

Thanks in advance!

Sa

Spaceant  
#8 Posted : Friday, February 23, 2007 4:35:41 AM(UTC)
Spaceant

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 8/16/2005(UTC)
Posts: 182

Could anyone kind enough to help me coding this? I have tried the following, but it is exactly what I want:

LB:=BBandBot(Typ(),20,S,2);

UB:=BBandTop(Typ(),20,S,2);

BY:=C<UB AND Ref(C<UB,-4) AND Sum(C>UB,4)<=3 AND Sum(C>UB,4)>=1;

SL:=C>LB AND Ref(C>LB,-4) AND Sum(C<LB,4)<=3 AND Sum(C<LB,4)>=1;

StopLE:=BarsSince(SL)<=5 AND C>=Ref(HHV(H,10),-1);

StopSE:=BarsSince(BY)<=5 AND C<=Ref(LLV(L,10),-1);

LE:=BY AND Alert(BY=0,2) OR StopLE;

SE:=SL AND Alert(SL=0,2) OR StopSE;

FilSTPUp:= CONDITION1;

FilSTPDn:= CONDITION2;

LX:=Cross(HHV(H – 2.5*ATR(5),10), C ) OR (1-FilSTPUp) AND H>=UB;

SX:=Cross(C, LLV(L + 2.5*ATR(5),10)) OR (1- FilSTPDn) AND L <=LB;

Tr:=ExtFml("Forum.Latch",LE, LX, SE, SX);

Tr

Use the long trade as an example, when long is triggered by "BY", the LX is to be based on H>=UB. When the long trade is triggered by "StopLE", the LX is to be based on Cross(HHV(H – 2.5*ATR(5),10), C ), not H>=UB .

Similarly, when the short trade is triggered by "SL", SX is to be based on L <=LB. When the short trade is tiggered by "StopSE", the SX is to be based on Cross(C, LLV(L + 2.5*ATR(5),10)), not L<=LB.

Sa

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.