PDA

View Full Version : Squeeze Breakout


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&#58;=sqz<>Ref&#40;sqz,-1&#41;;

&#123; Breakout &#125;
brk&#58;=Cross&#40;C,BBandTop&#40;C,BBpds,S,BBDev&#41;&#41;;

&#123; First breakout after the squeeze change &#125;
Init&#58;=Cum&#40;IsDefined&#40;change&#41;&#41;=1;
y&#58;=change AND &#40;Alert&#40;change=0,2&#41; OR Init&#41;;
z&#58;=brk AND &#40;Alert&#40;brk=0,2&#41; OR Init&#41;;
binary&#58;=ValueWhen&#40;1,y-z<>0,y-z&#41;;
breakout&#58;=
binary=-1 AND &#40;Alert&#40;binary>-1,2&#41; OR Init&#41;;

&#123; Exploration filter, or plot in own window &#125;
If&#40;plot=1,breakout,brk&#41;


jose '-)