MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Multi-Stop Indicator by Roy Larsen

Multi Stop Indicator

* To: <metastock@xxxxxxxxxxxxx>
* Subject: Multi Stop Indicator
* From: "Roy Larsen" <rlarsen@xxxxxxxxxxxxx>
* Date: Sun, 7 Oct 2001 12:54:30 +1300
* Sender: owner-metastock@xxxxxxxxxxxxx

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);
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}

{bars since entry >= bars since normal exit}
OR
{bars since entry >= bars since profit exit}
OR
{bars since entry >= bars since stop loss exit
then flag value is} 0,
{else flag value is}

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);}

Source / From: TOP
http://purebytes.com/archives/metastock/

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.