MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formulae between "---8<---" lines. ==================== System trade signals ==================== ---8<-------------------------- { System trade signals v2.5 } { ©Copyright 2005 Jose Silva } { For personal use only } { http://www.metastocktools.com } { Note on simultaneous entry/exit on same bar: #1 Ignore: entry/exit signals cancel each other; #2 Preference given to: new entry if currently Short, new exit if currently Long.} { Signals reference example } entry:=C>Mov(C,21,E); exit:=C0 OR Init, entry-exit); long:=bin1=1 AND (Alert(bin1<>1,2) OR Init); short:=bin1=-1 AND (Alert(bin1<>-1,2) OR Init); signals1:=long-short; { #2 - Preference to first entry/exit } long:=entry AND (Alert(entry=0,2) OR Init); short:=exit AND (Alert(exit=0,2) OR Init); bin2:=ValueWhen(1,long-short<>0 OR Init, long-short); long:=bin2=1 AND (Alert(bin2<1,2) OR Init); short:=bin2=-1 AND (Alert(bin2>-1,2) OR Init); signals2:=long-short; { Select #1 or #2 } binary:=If(choose=1,bin1,bin2); signals:=If(choose=1,signals1,signals2); { Plot in own window } Ref(If(plot=2,entry,0),-delay); Ref(If(plot=1,signals, If(plot=2,-exit,binary)),-delay) ---8<-------------------------- =============================== System trade signals - original =============================== ---8<-------------------------- { Original trade signals code } { BarsSince() function prevents first exit plot} { With thanks to Roy Larsen at http://www.metastocktips.co.nz } { Signals reference example } entry:=C>Mov(C,21,E); exit:=C-1)=1; entryInit:=Cum(entry)=1; flag:=BarsSince(Init OR entry) 0,signals); { Plot in own window } Ref(If(plot=1,signals, If(plot=2,entry-exit,binary)),-delay) ---8<-------------------------- http://www.metastocktools.com