log in     sign up for free
 
Show me the charts, and I'll tell you the news. Have an opinion on what the market should do but don't decide what the market will do. Be happy with a percentage of the move.
Bernard Baruch
 
 
Home
systems (284)
 
Special offer: buy AmiBroker and EOD+Real-Time Data
 

Buy

MetaStock

     (special offer)
 
 
 

Buy

EOD data for MetaStock

     (special offer)
 
 
 

Buy

Realtime data for MetaStock

     (special offer)
 
 
 
Formula Library
 
AmiBroker
MetaTrader
MetaStock
TradeStation
Wealth-Lab
NinjaTrader
 
add your formula
System Library
 
 
Account login
Your email:
Password:
 
Log in
New to s4t? Sign up.
If you forgot your password click here.
Search the Web
 
Custom Search

Multi-Stop Indicator

Formula for: MetaStock

indicator


 

 

Views:  1498

Added: July 19, 2007
 
Rate this code:  Rate: 1 Rate: 2 Rate: 3 Rate: 4 Rate: 5
This formula has not been rated yet
 

email this link

 
 
Tags: MetaStock, indicator
 
Your Ad Here


Code:

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


 






Author: Roy Larsen
Source: http://purebytes.com/archives/metastock/

 

View similar (indicator for MetaStock):

Elliott Wave Identification
TrapAbs Indicator
Double Stochastic - 10 Period
Chande's & Kroll's R2 Indicator
Offset Momentum Oscillator
Displace Indicator Forward
DS_EMA_X_MP()
ZigZag - Custom
Barnes' Moving Average
Bollinger Bands as Oscillator II
...
 
 
all formulas for MetaStock
all formulas

 

 

Email to friend

Top

 

     
However we try to maintain hiqhest possible level of service - most formulas, oscillators, indicators
and systems are submitted by anonymous users.
Therefore S4T™ does not take any responsibility for it's quality.
If you use any of this information, use it at your own risk. You are responsible for your own trading decisions.
Be sure to verify that any information you see on these pages is correct, and is applicable to your particular trade.
In no case will S4T™ be responsible for your trading gains or losses.
 
Privacy note | (c) copyrights systems4trading.com 2006-2012