Here is code to find out breakout for long.
Just copy it and paste in metastock--explorer--new--filter
--------------------------------------------------------------
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<Ref(LLV(x,pds2),-1);
Init:=Cum(In+Out>-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
AND Year()=2005