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

Re: Multi Stop Indicator



PureBytes Links

Trading Reference Links

Hi Roy,

just a short note to congratulate you on how much you manage to squeeze out
of MS :-) and also to thank you for sharing so much of your work with the
MS users.

During the last few months or so I have been developing a Dedicated System
Tester for my personal trading system in VBA-for-Excel so I haven't been
participating too much on the list. While it was a bit of work, there are
no limits to what you can do and if you find a bug you can fix it yourself.
No problems accessing equities, using SAR, designing special stops, etc.
Most important of all: each completed phase or module becomes the base for
future work... there are no limits. The programming environment is much
more professional: lots of programming examples, unlimited variables, full
screen editor, etc. There are also several low priced function libraries
for traders (for accessing MS data and indicator formulae) that you can buy
(I didn't use them). The major drawback it that VBA is slow... this is why
I am now thinking of switching to Visual C++ which is about a hundred times
faster.

If you have never looked at VBA-Excel or Visual C++ perhaps you should, you
appear to have a nack for programming and it should not be too difficult
for you to pick up. If you have looked into it I would like to hear about
your experience...

Thanks again for your contibutions to the list,
Take care,
Herman.

At 12:54 PM 10/7/01 +1300, you wrote:
>Here is a multi-stop indicator that may be useful to someone. I have
attempted to show how, without
>using PREV, it is possible to calculate either the MS profit or stop loss
exit prices. In theory it
>should also be possible to include other stops into the Ea (Entry Amount)
variable, but I will leave
>that to others who have such a bent.
>
>No allowance has been made for compounding equity as used in the MS System
Tester (too complex).
>However some option configurations (percent commissions and targets) will
track accurately even
>though this indicator only uses fixed equity.
>
>A number of variables are displayed in the attached gif to try and show
the outputs and uses that
>are possible. Comments have been added where these could be helpful.
>
>Roy
>
>  {Multi Stop Indicator}
>Nc:=Input("Entry Commission Points",0,99,20);
>Xc:=Input( "Exit Commission Points",0,99,20);
>Pt:=Input("Profit Target Points",1,500,150);
>Ls:=Input( "Maximum Loss Points",1,500,100);
>Np:=Input("Enter 1=Open 2=Close",1,2,2);
>Xo:=Input("Exit 1=Open 2=Close 3=Stop ",1,3,2);
>Equity:=1000;                   {Trade capital}
>N:=Cross(Mov(C,9,E),Mov(C,13,E));{Entry formula}
>X:=Cross(Mov(C,13,E),Mov(C,9,E));{Exit formula}
>I:=Cum(N<>-1 AND X<>-1)=1;      {Formulas valid}
>Np:=If(Np=1,O,If(Np=2,C,N));    {Entry price}
>Xp:=If(Xo=1,O,C);               {Exit price}
>Pf:=(Equity+Pt+Xc)/(Equity-Nc); {Profit factor}
>Lf:=(Equity-Ls+Xc)/(Equity-Nc); {Loss factor}
>
>Ea:=If(BarsSince(I OR N>0)>=BarsSince(I OR X>0
>  {bars since entry >= bars since normal exit}
>OR
>If(Xo<3,Xp,H)>=Pf*(ValueWhen(1,I OR (N>0 AND Alert(If(BarsSince(I
>OR N>0)>=BarsSince(I OR X>0),0,1)=0,2)), Np))
>  {bars since entry >= bars since profit exit}
>OR
>If(Xo<3,Xp,L)<=Lf*(ValueWhen(1,I OR (N>0 AND Alert(If(BarsSince(I
>OR N>0)>=BarsSince(I OR X>0),0,1)=0,2)), Np))),
>  {bars since entry >= bars since stop loss exit
>   then flag value is} 0,
>  {else flag value is}
>ValueWhen(1,I OR (N>0 AND Alert(If(BarsSince(I OR N>0)>=
>BarsSince(I OR X>0),0,1)=0,2)),Np));
>
>Xb:=Ea=0 AND Alert(Ea>0,2);    {Exit bar}
>Ev:=ValueWhen(1,I OR Ea>0,Ea); {Entry value}
>
>Sp:=If(Xb,If(Xo<3 AND Xp>=Ev*Pf,Xp,
> If(O>=Ev*Pf,O,If(H>=Ev*Pf,Ev*Pf,0))),0);
>{Profit sell price}
>
>Sl:=If(Xb,If(Xo<3 AND Xp<=Ev*Lf,Xp,
> If(O<=Ev*Lf,O,If(L<=Ev*Lf,Ev*Lf,0))),0);
>{Stop loss price}
>
>Nx:=If(Xb AND Sp=0 AND Sl=0,Xp,0);
>{Normal exit price}
>
>Ea; Ea*Pf; Ea*Lf; Sp; Sl; Nx;
>
>{* Substitute these variables for percent stops}
>{Pt:=Input("Profit Target %",1,99,15)/100;}
>{Ls:=Input( "Maximum Loss %",1,99,10)/100;}
>{Pf:=(Equity*(1+Pt)+Xc)/(Equity-Nc);}
>{Lf:=(Equity*(1-Ls)+Xc)/(Equity-Nc);}
>
>
>Attachment Converted: "c:\eudora2001\attach\snap3.gif"
>