Dr Alexander Elder followers may also be interested in the very powerful and versatile MACD-H Divergence kit: http://www.metastocktools.com/MACDH/MACDHdiverg.htm http://www.metastocktools.com/MACDH/96diverg.htm MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste formula below. ================================ Trailing Stop - Elder's SafeZone ================================ ---8<------------------------------------------ {Dr Alexander Elder's SafeZone trailing stop v3 SafeZone types: [1] Uses upside/downside penetration days as suggested by Dr Elder in his book; [2] Uses up/down days (instead of upside/downside penetration days) to match book's incorrect companion spreadsheet. Triggers: Long (+1) & Short (-1) signals at crossover of user-defined trailing stops. ©Copyright 2003-2007 Jose Silva For personal use only. http://www.metastocktools.com } { User inputs } coefficient:=Input("SafeZone coefficient", 0,10,2.5); bkpds:=Input("Lookback periods",1,260,10); pds:=Input("Trend EMA periods",2,260,21); adv:=Input("plot: [1]Today's SafeZone, [2]Tomorrow's stop",1,2,1)-1; type:=Input("SafeZone type: [1]Book, [2]Spreadsheet",1,2,1); plot:=Input("SafeZone: [1]Stop, [2]Long+Short, [3]Signals",1,3,1); { Downside penetrations } DwSidePen:= If(type=1,Mov(C,pds,E)>Ref(Mov(C,pds,E),-1),1) AND LRef(H,-1); UpSideDiff:=If(UpSidePen,H-Ref(H,-1),0); UpPenAvg:=Sum(UpSideDiff,bkpds) /Max(Sum(UpSidePen,bkpds),.000001); StShort:=Ref(H+UpPenAvg*coefficient,-1); StopShort:=If(C>PREV,StShort,Min(StShort,PREV)); { Stop signals } entry:=Cross(C,Ref(StopShort,-1)); exit:=Cross(Ref(StopLong,-1),C); { Clean signals } Init:=Cum(IsDefined(entry+exit))=1; bin:=ValueWhen(1,entry-exit<>0 OR Init, entry-exit); entry:=bin=1 AND (Alert(bin<>1,2) OR Init); exit:=bin=-1 AND (Alert(bin<>-1,2) OR Init); { Plot on price chart } If(plot=1,Ref(If(bin=1,stopLong,stopShort), -1+adv),If(plot=2,Ref(stopLong,-1+adv),0)); If(plot=1,Ref(If(bin=1,stopLong,stopShort), -1+adv),If(plot=2,Ref(stopShort,-1+adv), entry-exit)) ---8<------------------------------------------ http://www.metastocktools.com