weird
5th April 2005, 02:00 PM
Hi Jose
Is it possible with metastock to find the first breakout after the squeeze, regardless of the periods between both ?
BBWidth:=(BBandTop(C,40,S,2)-BBandBot(C,40,S,2))/Mov(C,40,S);
x:=LLV(BBWidth,125); {SQUEEZE}
y:=Cross(C,BBandTop(C,40,S,2)); {BREAKOUT}
{First breakout after the squeeze}
Jose
5th April 2005, 11:18 PM
Try this:
{ Variables }
BBpds:=40;
BBDev:=2;
LLVpds:=125;
plot:=1; { Breakouts: [1]1st, [2]All }
{ BB width }
BBWidth:=(BBandTop(C,BBpds,S,BBDev)-BBandBot(C,BBpds,S,BBDev))/Mov(C,BBpds,S);
{ Squeeze }
sqz:=LLV(BBWidth,LLVpds);
change:=sqz<>Ref(sqz,-1);
{ Breakout }
brk:=Cross(C,BBandTop(C,BBpds,S,BBDev));
{ First breakout after the squeeze change }
Init:=Cum(IsDefined(change))=1;
y:=change AND (Alert(change=0,2) OR Init);
z:=brk AND (Alert(brk=0,2) OR Init);
binary:=ValueWhen(1,y-z<>0,y-z);
breakout:=
binary=-1 AND (Alert(binary>-1,2) OR Init);
{ Exploration filter, or plot in own window }
If(plot=1,breakout,brk)
jose '-)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.