PureBytes Links
Trading Reference Links
|
======================
Holy Grail Long system
======================
---8<--------------------------
{ Holy Grail Long system signals v786.5 }
{ Enter Long = +1, Exit Long = -1 }
{ ©Copyright 2004 Jose Silva }
{ http://users.bigpond.com/prominex/pegasus.htm }
pds:=Input("Avg trade periods",2,252,21);
delay:=Input("Entry and Exit delay",0,5,0);
plot:=Input("plot: [1] entry/exit signals, [2] trade binary",1,2,1);
FibSeriesSum:
=1+1/1+1/2+1/3+1/5+1/8+1/13+1/21+1/34+1/55+1/89+1/144+1/233+1/377+1/61
0;
x:=Frac(FibSeriesSum+LastValue(ValueWhen(1,C<Ref(ValueWhen(1,Cos(1.
375)>Cos(7.75),C),pds)*Sin(71.286),C)+PREV-PREV)-FibSeriesSum);
In:=x>Ref(x,-1);
Out:=BarsSince(in)=pds-2;
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=Ref(BarsSince(Init OR In)
< BarsSince(Init OR Out)+InInit,-delay);
In1:=Cum(Cum(In))=1;
Out1:=Cum(Cum(Out))=1;
signals:=(InInit AND Alert(InInit=0,2)
OR flag AND Alert(flag=0,2))
+-(flag=0 AND Alert(flag,2));
odd:=Cum(1)/2=Int(Cum(1)/2);
Ref(If(plot=1,In1,0),-delay);
-(plot=1 AND Ref(Out1 AND BarsSince(In1)
>=BarsSince(Out1),-delay));
If(plot=1,0,If(odd,flag,0));
If(plot=1,signals,flag)
---8<--------------------------
=================================
Holy Grail system Trade Equity LE
=================================
---8<----------------------------
{Trade Equity LE} {V4.2b}
{© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
B:=Input("Entry 1=O 2=C 3=H 4=L 5=Stop",1,5,1);
Z:=Input("Exit 1=O 2=C 3=H 4=L 5=Stop" ,1,5,1);
Nd:=Input("Entry Delay",0,3,1);
Xd:=Input("Exit Delay", 0,3,1);
Cn:=Input("Entry / Exit Costs",0,9999,3434);
En:=Input("Display Options 0-12",0,12,0);
Cp:=10000; {* trade capital, 0 = points only}
F:=1; {* position size, <1 = %, >1 = shares}
N:= Fml("Holy Grail Long system"); {Enter Long}
Ns:=0;
X:= Fml("Holy Grail Long system")=-1; {Close Long}
Xs:=0;
{* end user area *}
{* use Xs with caution *}
F:=If(F=0,1,F);
Ns:=(B=5)*Ns;
Cx:=Cn-100*Int(Cn/100);
Cn:=Int(Cn/100);
M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C))));
N:=N AND Alert(N=0,2);
X:=If(Z<5,X AND Alert(X=0,2),0);
N:=If(Nd=0,N,Alert(N,Nd+1) AND Alert(N,Nd)=0);
N:=If(B<5,N,Ns>0);
Y:=If(Xs>0,Min(H,Max(L,Xs)),
If(Z=1,O,If(Z=3,H,If(Z=4,L,C))));
X:=If(Xd=0,X,Alert(X,Xd+1) AND Alert(X,Xd)=0);
X:=X OR Xs>0;
Y:=If(Z<5 AND X=0,C,Y);
Y:=If(Xs>0 AND N AND X,Xs,Y);
I:=Cum((N+X)>-1)=1;
Y:=If(I,Y,If((N+X=0)+Alert(N+X=2,2)=2,ValueWhen(2,1,Y),Y));
N:=If(I>-1,N,0);
F:=ValueWhen(1,I OR N,F);
Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1));
Tr:=If(N+X>1 AND (Alert(Tr,2) OR (Nd+Xd<1 AND
B<>2 AND Z>1 AND (Max(B,Z)>4 OR B<>Z))),1,Tr);
Nd:=En;
En:=Tr+Alert(Tr=0,2)=2 OR I;
Ex:=Tr=0 AND Alert(Tr,2);
M:=If(I AND N=0,C,M);
Lb:=Alert(Tr,2) AND LastValue(Cum(1))=Cum(1);
A:=ValueWhen(1,En,M);
F:=ValueWhen(1,En,If(F<1,Cp*F,If(F>1, (A*F)+Cn,Cp)));
En:=Tr+(Alert(Tr=0,2)+I>0)=2;
Z:=Nd;
N:=If(Ex+Lb>0,If(Cp=0,Y-A-Cn-Cx,(F-Cn)*(Y/A)-F-If(Ex,Cx,0)),0);
B:=If(Alert(Tr,2),1+BarsSince(En OR I),0);
Xs:=If(Alert(Tr,2),If(Cp=0,Y-A,(F-Cn)*(Y/A)-F-If(Ex,Cx,0)),0);
Nd:=LowestSince(1,I,Xs);
Ns:=HighestSince(1,I,Xs);
X:=Cum((Ex+Lb>0 AND N>0)*B);
Xd:=Cum((Ex+Lb>0 AND N<=0)*B);
M:=Cum(N)+Cp+(Tr AND Lb=0)* If(Cp=0,Y-A-Cn,(F-Cn)*(Y/A)-F); {M;}
{ options
0 total $ equity
1 total % equity
2 $ equity/trade
3 % equity/trade
4 winning trade $
5 losing trade $
6 winning trade #
7 losing trade #
8 trade in progress
9 bars/trade
10 bars/all trades
11 MFE
12 MAE}
If(Z=0,M,
If(Z=1,100*(M-Cp)/Cp,
If(Z=2,N+M-Cp-Cum(N),
If(Z=3,100*(N+M-Cp-Cum(N))/Cp,
If(Z=4,Cum((N>0)*N),
If(Z=5,Cum((N<0)*N),
If(Z=6,Cum(N>0),
If(Z=7,Cum(Ex+Lb>0 AND N<=0),
If(Z=8,Tr,
If(Z=9,BarsSince(I OR Alert(Tr,2)=0)*Alert(Tr,2),
If(Z=10,Cum(Alert(Tr,2)),
If(Z=11,Ns,Nd))))))))))))
---8<----------------------------
With thanks to Roy Larsen for use of Trade Equity LE indicator.
jose '-)
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/zMEolB/TM
---------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|