# Formula for BreakOut of Bollinger Bands in Daily and Weekly

I was looking for a formula that would give me the Break Outs of Bollingeur Bands (BB) in Daily(D) and Weekly(W). Finding nothing to my liking, I wrote one.

In an upward wave, we often have several BB Brake Outs.

To overcome this problem I added the Stockastic Crossing to my formula

Cross(StochK(9,3),StochD(9,3,3))

On a daily(D) graph, we have the result:

The BB BreakOut in daily: function BrOutBb(P) in orange

And the BB BreakOut in weeklyk: BrOutBb_W(15) in blue and orange on a TF weekly(W)

The function BrOutBb(P)- orange gives me the BrOutdeBB on the Time Frame(TF) that we have on the screen (D or W) and I like their result. Whether itâ€™s a daily(D) or a weekly(W).

The BrOutBbW-in blue, on the TF daily is very disappointing.

I am open to any comments to do better.

THANKS

````Code button (use to enter/paste AFL formula)`
_SECTION_BEGIN("CrBB Week In Daily de base");
/* Test pour les BraakeOut de BB en jour et semaine */
function BBT(P) { bon= BBandTop(C,P,2) ; return bon ; } ;
function CrBBT(P) { bon= Cross(C,BBT(P)) ; return bon ; } ;
function BrOutBb(P)
{bon= IIf( CrBBT(P) AND Ref(BarsSince(CrBBT(P))>MaxP,-1) , 1 ,0 ) ;
Bon= IIf(Bon==1,2,0) ; return Bon ; }

Plot( BrOutBb(15),"BrOutBB-D",colorOrange,styleOwnScale );

TimeFrameSet( inweekly ); // switch now to week