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

[EquisMetaStock Group] Re: Month-Week System



PureBytes Links

Trading Reference Links



Try Roy's amazing equity indicator:

---8<---------------------------

  {Trade Equity LE} {V5.0}
  {© 2004 Roy Larsen, rlarsen@xxxxxxxxxxxxxx}
B:=Input("Buy  1=O 2=C 3=H 4=L 5=Stop" ,1,5,2);
Z:=Input("Sell  1=O 2=C 3=H 4=L 5=Stop",1,5,2);
Nd:=Input("Buy Delay", 0,5,0);
Xd:=Input("Sell Delay",0,5,0);
Cn:=Input("Buy / Sell Costs",0,9999,3030);
En:=Input("Display Option 0-12",0,12,0);
Cp:=5000; {* trade capital}
F:=1; {* trade size Fml(), <1 =%, >1 =shares}
N:=Fml("Monthly trade signals")=1; {Buy}
Ns:=0;
X:=Fml("Monthly trade signals")=-1; {Sell}
Xs:=0;
  {* end of user area *}
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)+(Cum(N>-1)=1);
X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1));
N:=If(Nd=0,N,Alert(N,Nd+1)*(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)*(Alert(X,Xd)=0));
X:=X+Xs>0;
Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y);
I:=Cum((F+N+X)>-1)=1;
Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y);
N:=(I>-1)*N;
F:=ValueWhen(1,I+N,F);
Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1));
Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4 OR 
B<>Z))),1,Tr);
Nd:=En; En:=Tr+Alert(Tr=0,2)=2 OR I;
Ex:=(Tr=0)*Alert(Tr,2);
M:=If(I*(N=0),C,M);
Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1));
A:=ValueWhen(1,En,If(M=0,1,M));
F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F));
En:=Tr*(Alert(Tr=0,2)+I>0);Z:=Nd;
N:=(Ex+Lb>0)*If(Cp=0,Y-A-Cn-Cx,(F-Cn)*(Y/A)-F-Ex*Cx);
B:=If(Alert(Tr,2),1+BarsSince(En OR I),0);
Xs:=Alert(Tr,2)*If(Cp=0,Y-A,(F-Cn)*(Y/A)-F-Ex*Cx);
Nd:=LowestSince(1,I,Xs);
Ns:=HighestSince(1,I,Xs);
X:=Cum((Ex+Lb>0)*(N>0)*B);
Xd:=Cum((Ex+Lb>0)*(N<=0)*B);
M:=Cum(N)+Cp+Tr*(Lb=0)*If(Cp=0,Y-A-Cn,(F-Cn)*(Y/A)-F);{M;}
 {Display 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}
X:=(Cp>0)/(Cp+(Cp=0));
If(Z=0,M,
If(Z=1,100*(M-Cp)*X,
If(Z=2,N+M-Cp-Cum(N),
If(Z=3,100*(N+M-Cp-Cum(N))*X,
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<---------------------------

jose '-)


--- In equismetastock@xxxxxxxxxxxxxxx, Dominick <Dom2000@xxxx> wrote:
> Hi Jose:
> 
> Yes that's it.  Is there anyway to plot an equity line ?
> 
> Jose wrote:
> 
> >
> > Bug in the previous code - try this:
> >
> > =====================
> > Monthly trade signals
> > =====================
> > ---8<------------------
> >
> > { User inputs }
> > In:=Input("Buy on nth trading day",1,22,1);
> > Ex:=Input("Sell on nth trading day",1,22,5);
> >
> > { Month true start }
> > mthStart:=Month()<>ValueWhen(2,1,Month());
> >
> > { Trading day of month }
> > mthDay:=BarsSince(mthStart)+1;
> >
> > { Buy/Sell signals }
> > buy:=mthDay=In;
> > sell:=mthDay=Ex;
> >
> > { Plot signals in own window }
> > buy-sell
> >
> > ---8<------------------
> >
> > jose '-)
> >
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, "Jose" <josesilva22@xxxx>
> > wrote:
> > >
> > > Try this:
> > >
> > > =====================
> > > Monthly trade signals
> > > =====================
> > > ---8<------------------
> > >
> > > { User inputs }
> > > In:=Input("Buy on nth trading day",1,22,1);
> > > Ex:=Input("Sell on nth trading day",1,22,5);
> > >
> > > { Month true start }
> > > mthCount:=Cum(Month()<>ValueWhen(2,1,Month()));
> > > mthStart:=mthCount<>ValueWhen(2,1,mthCount);
> > >
> > > { Trading day of month }
> > > mthDay:=BarsSince(mthStart);
> > >
> > > { Buy/Sell signals }
> > > buy:=mthDay=In;
> > > sell:=mthDay=Ex;
> > >
> > > { Plot signals in own window }
> > > buy-sell
> > >
> > > ---8<------------------
> > >
> > > jose '-)
> > >
> > >
> > > --- In equismetastock@xxxxxxxxxxxxxxx, Dominick <Dom2000@xxxx>
> > wrote:
> > > > Hi All:
> > > >
> > > > Would someone be so kind to help me with this.
> > > > I'm using version 7.2
> > > > and I've been trying to write a system that would buy and
> > > > sell the first week only of each month.  For ex.  Buy at open 
on
> > > > day 1 and sell at close on day 5 of month one and
> > > > continue to month 12.  Obviously I've haven't even come close.
> > > >
> > > > TIA,
> > > >
> > > > dom






------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
    equismetastock-unsubscribe@xxxxxxxxxxxxxxx

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