Australian (ASX) Stock Market Forum

Bollinger Band Squeeze Scan/Exploration

Hello , I found the following in my collection, just in case some one is still looking out.

_SECTION_BEGIN("Unnamed 6");
/*
BB Squeeze (conversion for TS code)


Instructions
Insert Linked to new chart pane
Periods can be selected in Param window
*/
/*
It can be used to determine the periods of extremes of low volatility which usually followed by big moves.Indicator does not show direction of the trade, only timing. Some other aspects of technical/fundamental analysis should be employed for direction.

There is a signal line with colored dots. Red dots indicate periods of low volatility (sqeeze).
Green dots indicate periods of high volatility.
Indicator line crosses above and below signal line. Time trades at historical extremes of low volatility.

It can be used for scans, for instance, to find stepper stocks before big moves.
The original author of the idea uses it for intraday trading.

For confirmation look for sqeezes in two different time frames.
*/



Price = Close;
Length = Param("Length",20,2,100,1); // { Length for Average True
//Range (ATR)}
Lenght1 = Param("Length1",20,2,100,1); // { Std. Deviation (SD)
//Calcs }

nK = Param("Channel ATRs",1.5,0.1,2,0.1); //{ Keltner Channel ATRs
//from Average }
nBB = Param("BB Std Devs",2,0.1,3,0.1); // { Bollinger Band Std.
//Devs. from Average }
AlertLine = Param("AlertLine",1,0,3,1); //{ BBS_Index level at which
//to issue alerts }

NormalColor = colorRed; //{ Normal color for BBS_Ind }
AlertlColor = colorBlue; //{ Color for BBS_Ind below alert line }


LHMult = Nz(PointValue/TickSize);

//{-- Calculate BB Squeeze Indicator ----------------------}
AvgTrueRange = ATR(Length);
SDev = StDev(Price, Length);

Denom = nK*AvgTrueRange;
BBS_Ind = Nz((nBB * SDev) /Denom);

SetPlotColor = IIf( BBS_Ind < Alertline, NormalColor, AlertlColor);
BBcrossDown = Cross(AlertLine,BBS_Ind);
BBcrossUp = Cross(BBS_Ind,AlertLine);

SetChartOptions( 0, chartShowDates|chartWrapTitle );
GraphXSpace=10;
//_N(Title = "{{NAME}} - {{INTERVAL}} {{DATE}} "+_DEFAULT_NAME()+" :
//{{OHLCX}} {{VALUES}}");
//+"\nALERT: "+WriteIf(BBcrossDown,"BB Squeeze Alert",WriteIf
//(BBcrossUp,"BB Squeeze Is Over","")) );


//{-- Plot the Index & Alert Line -------------------------}
Plot(0, "BBS_Ind", SetPlotColor, styleDots );

//{-- Plot delta of price from Donchian mid line ----------}
value2 = LinearReg( price-((HHV(H, Lenght1)+LLV(L, Lenght1))/2+ MA
(C,Lenght1))/2, Lenght1);
color = IIf( value2 > 0, IIf( value2 > Ref(value2,-1), colorGreen,
colorDarkGreen),
IIf( value2 < 0, IIf( value2 < Ref(value2,-1), colorRed,
colorDarkRed ), colorYellow ));

Plot(value2*LHMult, "NickmNxtMove", color, styleArea );
Plot(value2,"BB Squeeze",color, styleArea );
//{-- Issue Alert when the Squeeze is On ------------------}
//"ALERT";
//Write alerts to Interpretation window
//Ticker = Name();
//WriteIf(BBcrossDown,Ticker + " " + "BB Squeeze Alert" ,WriteIf
//(BBcrossUp,Ticker + " " + "BB Squeeze Is Over",""));

//Write alerts to Alert Output window
AlertIf(BBcrossDown,"","BB Squeeze Alert",0);
AlertIf(BBcrossUp,"","BB Squeeze Is Over",0);

//Sound alerts
//AlertIf( BBcrossDown, "SOUND
//C:\\Windows\\Media\\RINGIN.WAV", "Audio alert", 2 );
//AlertIf( BBcrossUp, "SOUND C:\\Windows\\Media\\RINGIN.WAV", "Audio
//alert", 2 );


//Write text to screen
/*
for(i=1;i<BarCount;i++)
{
if(BBcrossDown)
{
PlotText("BB Squeeze Alert",i,-6,colorWhite);
}
if(BBcrossUp)
{
PlotText("BB Squeeze Is Over",i,-3,colorWhite);
}
}
*/
PlotShapes(shapeUpArrow*BBcrossDown,colorBrightGreen,0,0);
PlotShapes(shapeDownArrow*BBcrossup,colorBrightGreen,0,0);

_SECTION_END();
_SECTION_END();

_SECTION_BEGIN("2Dsqueeze");

//please Scan with this AFL in Houly TF. Its trying to find out price fluctuating notmore than 3.5% in last 10 hrs(roughly 2 days).
//2 Day Squeeze
D2Squeeze20=(HHV(H,2)-LLV(L,2))<0.20*(HHV(H,10)-LLV(L,10)) AND MA(V,2)<MA(V,5) AND Ref(V,-1)>V AND Ref(V,-2)>Ref(V,-1);
D2Squeeze30=(HHV(H,2)-LLV(L,2))<0.30*(HHV(H,10)-LLV(L,10)) AND MA(V,2)<MA(V,5) AND Ref(V,-1)>V AND Ref(V,-2)>Ref(V,-1);
D2Squeeze40=(HHV(H,2)-LLV(L,2))<0.40*(HHV(H,10)-LLV(L,10)) AND MA(V,2)<MA(V,5) AND Ref(V,-1)>V AND Ref(V,-2)>Ref(V,-1);
D2Squeeze50=(HHV(H,2)-LLV(L,2))<0.50*(HHV(H,10)-LLV(L,10)) AND MA(V,2)<MA(V,5) AND Ref(V,-1)>V AND Ref(V,-2)>Ref(V,-1);
D2Squeeze60=(HHV(H,2)-LLV(L,2))<0.60*(HHV(H,10)-LLV(L,10)) AND MA(V,2)<MA(V,5) AND Ref(V,-1)>V AND Ref(V,-2)>Ref(V,-1);
Filter= D2Squeeze20 OR D2Squeeze30 OR D2Squeeze40 OR D2Squeeze50 OR D2Squeeze60;
AddColumn(C," CMP ",1.1,colorBlack,colorLightGrey);
AddColumn(IIf(D2Squeeze20,1,Null),"D2Sq20",1.1,colorDefault,IIf(D2Squeeze20,colorDarkYellow,Null));
AddColumn(IIf(D2Squeeze30,1,Null),"D2Sq30",1.1,colorDefault,IIf(D2Squeeze30,colorDarkYellow,Null));
AddColumn(IIf(D2Squeeze40,1,Null),"D2Sq40",1.1,colorDefault,IIf(D2Squeeze40,colorYellow,Null));
AddColumn(IIf(D2Squeeze50,1,Null),"D2Sq50",1.1,colorDefault,IIf(D2Squeeze50,colorPaleBlue,Null));
AddColumn(IIf(D2Squeeze60,1,Null),"D2Sq60",1.1,colorDefault,IIf(D2Squeeze60,colorDarkBlue,Null));
_SECTION_END();
 
Top