MetaStock -> Tools -> Indicator Builder -> New Copy and paste formula below. ================ Breakout signals ================ ---8<--------------------------- { Breakout Long signals } { ©Copyright 2003~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } pds1:=Input("Entry Long breakout periods", 1,252,21); pds2:=Input("Exit Long breakout periods", 1,252,10); x:=Input("use Open=1 High=2 Low=3 Close=4 Volume=5 WC=6",1,6,4); delay:=Input("Entry and Exit delay",0,5,0); plot:=Input("Signals: [1]Clean, [2]All, [3]Trade binary",1,3,1); { Select breakout price field } x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,If(x=6,WC(),C))))); { Entry/Exit Long breakouts } entry:=x>Ref(HHV(x,pds1),-1); exit:=x0 OR init,long); long:=flag*(Alert(flag=0,2) OR init); short:=(flag=0)*(Alert(flag,2) OR init); signals:=long-short; { Plot in own window } Ref(If(plot=2,entry,0),-delay); Ref(If(plot=1,signals, If(plot=2,-exit,flag)),-delay) ---8<--------------------------- MetaStock -> Tools -> The Explorer -> New Copy and paste formulae below. ================ Breakout signals ================ Signals a Buy Long on price breakout Exploration filter ================== ---8<--------------------------- pds1:=21; {HHV (long) breakout periods} pds2:=10; {LLV (short) breakout periods} x:=4; {use Open=1 High=2 Low=3 Close=4 Vol=5} x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C)))); In:=x>Ref(HHV(x,pds1),-1); Out:=x-1)=1; InInit:=Cum(In)=1; Flag:=BarsSince(Init OR In) < BarsSince(Init OR Out)+InInit; BuyLong:=InInit AND Alert(InInit=0,2) OR Flag AND Alert(Flag=0,2); BuyLong ---8<--------------------------- =============== Breakin signals =============== Signals Sell Long on price collapse Exploration filter ================== ---8<--------------------------- pds1:=21; {HHV (long) breakout periods} pds2:=10; {LLV (short) breakout periods} x:=4; {use Open=1 High=2 Low=3 Close=4 Vol=5} x:=If(x=1,O,If(x=2,H,If(x=3,L,If(x=5,V,C)))); In:=x>Ref(HHV(x,pds1),-1); Out:=x-1)=1; InInit:=Cum(In)=1; Flag:=BarsSince(Init OR In) < BarsSince(Init OR Out)+InInit; SellLong:=Flag=0 AND Alert(Flag,2); SellLong ---8<--------------------------- http://www.metastocktools.com