MetaStock -> Tools -> Indicator Builder -> New Copy and paste formulae below. ========================== Smart System design - Long ========================== ---8<--------------------------- { Simple combined Entry & Exit system } { Plots +1 spike on entry, -1 on exit signals } { Warning: this trading system is a design example only - do not trade! } { ©Copyright 2003 Jose Silva } { http://www.metastocktools.com } {*** user input section ***} delay:=1; {delay entry/exit x periods} pds:=Input("global entry/exit periods", 1,252,21); En1:=Input("enable EMA entry",0,1,1); En2:=Input("enable HHV entry",0,1,1); Ex1:=Input("enable EMA exit",0,1,1); Ex2:=Input("enable LLV exit",0,1,1); Ex3:=Input("enable ATR exit",0,1,1); {*** place your entry/exit conditions here ***} EntryCond1:=Cross(C,Mov(C,pds,E)*1.05); EntryCond2:=Cross(C,Ref(HHV(C,pds),-1)); ExitCond1:=C-1)=1; Flag:=BarsSince(Init OR In) < BarsSince(Init OR Out)+(Cum(In)=1); {*** system signals display section ***} Ref(Flag AND Alert(Flag=0,2),-delay)- Ref((Flag=0 AND Alert(Flag,2)),-delay) ---8<--------------------------- More advanced system developers: ================================= Smart System Long Entry developer ================================= ---8<--------------------------- { Plots +1 spike on Long entry signal } { Warning: this trading system is a design example only - do not trade! } { ©Copyright 2003 Jose Silva } { http://www.metastocktools.com } {*** user input section ***} pds:=Input("global entry periods",1,252,21); En1:=Input("enable EMA entry",0,1,1); En2:=Input("enable HHV entry",0,1,1); En3:=Input("enable ATR entry",0,1,1); En4:=Input("enable WR% entry",0,1,1); En5:=Input("enable CMF entry",0,1,1); {*** place your entry Long conditions here ***} Entry1:=Cross(C,Mov(C,pds,E)*1.05); Entry2:=Cross(C,Ref(HHV(C,pds),-1)); Entry3:=Cross(C,HHV(C-2.5*ATR(pds),pds)); Entry4:=Cross(WillR(pds),-50); Entry5:=Cross(CMF(pds),0); {*** system logic section ***} En1:=If(En1,Entry1,0); En2:=If(En2,Entry2,0); En3:=If(En3,Entry3,0); En4:=If(En4,Entry4,0); En5:=If(En5,Entry5,0); entry:=En1 OR En2 OR En3 OR En4 OR En5; {*** system entry output section ***} entry ---8<--------------------------- ================================ Smart System Long Exit developer ================================ ---8<--------------------------- {Plots -1 spike on Long exit signal} {Warning: this trading system is a design example only - do not trade!} {©Copyright 2003 Jose Silva} {http://www.metastocktools.com} {*** user input section ***} pds:=Input("global exit periods",1,252,10); Ex1:=Input("enable EMA exit",0,1,1); Ex2:=Input("enable LLV exit",0,1,1); Ex3:=Input("enable ATR exit",0,1,1); Ex4:=Input("enable WR% exit",0,1,1); Ex5:=Input("enable CMF exit",0,1,1); {*** place your exit Long conditions here ***} Exit1:=C-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); 0; Ref(If(plot=1,In1,0),-delay); If(plot=1,-Ref(Out1 AND BarsSince(In1) >=BarsSince(Out1),-delay),0); If(plot=1,0,If(odd,flag,0)); If(plot=1,signals,flag) ---8<--------------------------- http://www.metastocktools.com