[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Metastockusers] Compounding Versions of Trade Equity Indicators



PureBytes Links

Trading Reference Links

The following long and short "compounding" versions of the Trade Equity
indicator family may be of interest to some. There are four explorations
available for each indicator if required, though I suggest that the "equal"
indicators and explorations give more realistic results. The explorations
based on these indicators also run very slowly because of the use of PREV in
the compounding equity calculations. If anyone can provide a non-dll based
compounding calculation that does not use PREV I would be very glad to hear
about it.

Faster dll based indicators and explorations (no PREV) are available upon
request to me directly. Note that dll assisted indicators will not run on MS
6.52, but the indicators below will. There are some issues with explorations
in MS 7.0 Pro but nothing that can't be worked around.

  {Trade Equity LC} {V2.7 long compound}
  {* user default settings *}
No:=Input("Enter 1=O 2=C 3=H 4=L 5=Stop",1,5,2);
Xo:=Input(" Exit 1=O 2=C 3=H 4=L 5=Stop",1,5,2);
Nd:=Input("Entry delay",0,3,0);
Xd:=Input(" Exit delay",0,3,0);
Cm:=Input("Entry commission $",0,99,00);
Cx:=Input(" Exit commission $",0,99,00);
Cp:=6000;  {* initial capital *}
N:= Fml("PS Fractal Entry")>0;
Ns:=0;
X:= Fml("PS Fractal Exit")>0;
Xs:=0;
  {* use 'Xs' with caution when Xo <> 5 *}
  {* end of user area *}
Ns:=If(No=5,Ns,0);
Np:=If(Ns>0,Ns,If(No=1,O,If(No=3,H,If(No=4,L,C))));
N:=N AND Alert(N=0,2); X:=X AND Alert(X=0,2);
N:=If(Nd=0,N,Alert(N,Nd+1) AND Alert(N,Nd)=0);
N:=If(No=5 AND Ns>0,1,If(No<5,N,0));
Xp:=If(Xs>0,Min(H,Max(L,Xs)),If(Xo=1,O,If(Xo=3,H,If(Xo=4,L,C))));
X:=If(Xd=0,X,Alert(X,Xd+1) AND Alert(X,Xd)=0);
X:=If(Xs>0,1,X);
Xp:=If(Xo<5 AND No=5 AND X=0,C,Xp);
Xp:=If(Xs>0 AND N AND X,Xs,Xp);
Xp:=If(Ref(N AND X,-1),Ref(Xp,-1),Xp);
I:=Cum((N+Ns+X+Xs)>-1)=1;
Tr:=BarsSince(I OR N)<BarsSince(I OR X);
Tr:=If(N+X>1 AND (Alert(Tr,2) OR (Nd+Xd<1 AND
No<>2 AND Xo>1 AND (Max(No,Xo)>4 OR No<>Xo))),1, Tr);
Np:=If(I AND N=0,C,Np);
En:=(Tr AND Alert(Tr=0,2)) OR I;
Ex:=Tr=0 AND Alert(Tr,2);
Lb:=(Alert(Tr,2)) AND LastValue(Cum(1)-0)=Cum(1);
Ea:=ValueWhen(1,En,If(No=5 AND N AND X,Np,Max(O,Np)));
Ea:=If(No<5,ValueWhen(1,En,Np),Ea);
En:=Tr AND Alert(Tr=0,2);
N:=Cum(If(I,Cp,0)-If(En,Cm,0)-If(Ex,Cx,0));
Ns:=Cum(If(Alert(Tr,2) AND If(No=5,1,En=0),
(PREV+If(No=5 AND En,N,Ref(N,-1)))*
If((No=5 AND En) OR (No<5 AND En=0 AND Alert(En,2)),
(Xp-Ea)/Ea,(Xp-Ref(Xp,-1))/Ref(Xp,-1)),0));
X:=(N+Ns+If(Ex,Cx,0))*Ea/Xp;
Xs:=If((Ex OR Lb) AND (N+Ns)>X+Cx,N+Ns-X-Cm,0);
Xd:=If((Ex OR Lb) AND (N+Ns)<=X+Cx,N+Ns-X-Cm,0);
Nd:=If(Alert(Tr,2),N+Ns-Cm-ValueWhen(1,I OR En,(N+Ns)),0);
N+Ns;

  {Trade Equity SC} {V2.7 short compound}
  {* user default settings *}
No:=Input("Enter 1=O 2=C 3=H 4=L 5=Stop",1,5,2);
Xo:=Input(" Exit 1=O 2=C 3=H 4=L 5=Stop",1,5,2);
Nd:=Input("Entry delay",0,3,1);
Xd:=Input(" Exit delay",0,3,1);
Cm:=Input("Entry commission $",0,99,30);
Cx:=Input(" Exit commission $",0,99,30);
Cp:=6000;  {* initial capital *}
N:= Fml("PS Fractal Exit")>0;
Ns:=0;
X:= Fml("PS Fractal Entry")>0;
Xs:=0;
  {* use 'Xs' with caution when Xo <> 5 *}
  {* end of user area *}
Ns:=If(No=5,Ns,0);
Np:=If(Ns>0,Ns,If(No=1,O,If(No=3,H,If(No=4,L,C))));
N:=N AND Alert(N=0,2); X:=X AND Alert(X=0,2);
N:=If(Nd=0,N,Alert(N,Nd+1) AND Alert(N,Nd)=0);
N:=If(No=5 AND Ns>0,1,If(No<5,N,0));
Xp:=If(Xs>0,Min(H,Max(L,Xs)),If(Xo=1,O,If(Xo=3,H,If(Xo=4,L,C))));
X:=If(Xd=0,X,Alert(X,Xd+1) AND Alert(X,Xd)=0);
X:=If(Xs>0,1,X);
Xp:=If(Xo<5 AND No=5 AND X=0,C,Xp);
Xp:=If(Xs>0 AND N AND X,Xs,Xp);
Xp:=If(Ref(N AND X,-1),Ref(Xp,-1),Xp);
I:=Cum((N+Ns+X+Xs)>-1)=1;
Tr:=BarsSince(I OR N)<BarsSince(I OR X);
Tr:=If(N+X>1 AND (Alert(Tr,2) OR (Nd+Xd<1 AND
No<>2 AND Xo>1 AND (Max(No,Xo)>4 OR No<>Xo))),1, Tr);
Np:=If(I AND N=0,C,Np);
En:=(Tr AND Alert(Tr=0,2)) OR I;
Ex:=Tr=0 AND Alert(Tr,2);
Lb:=(Alert(Tr,2)) AND LastValue(Cum(1)-0)=Cum(1);
Ea:=ValueWhen(1,En,If(No=5 AND N AND X,Np,Min(O,Np)));
Ea:=If(No<5,ValueWhen(1,En,Np),Ea);
En:=Tr AND Alert(Tr=0,2);
N:=Cum(If(I,Cp,0)-If(En,Cm,0)-If(Ex,Cx,0));
Ns:=Cum(If(Alert(Tr,2) AND If(No=5,1,En=0),
(ValueWhen(1,En,PREV)+If(No=5 AND En,N,Ref(N,-1)))*
If((No=5 AND En) OR (No<5 AND Alert(En,2) AND En=0),
(Ea-Xp)/Ea,(Ref(Xp,-1)-Xp)/Ea),0));
X:=If(Alert(Tr,2),2*Ea-Xp,Ea); X:=Ea*(N+Ns+If(Ex,Cx,0))/X;
Xs:=If((Ex OR Lb) AND (N+Ns)>X+Cx,N+Ns-X-Cm,0);
Xd:=If((Ex OR Lb) AND (N+Ns)<=X+Cx,N+Ns-X-Cm,0);
Nd:=If(Alert(Tr,2),N+Ns-Cm-ValueWhen(1,I OR En,(N+Ns)),0);
N+Ns;



------------------------ Yahoo! Groups Sponsor ---------------------~-->
4 DVDs Free +s&p Join Now
http://us.click.yahoo.com/pt6YBB/NXiEAA/MVfIAA/zMEolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/