[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

squeeze



PureBytes Links

Trading Reference Links

{ Bolinger Band Squeeze (BBS) Indicator }

{ A variation of an idea by nickm001 (Originally coded by eKam) that when
Bollinger Bands (BB) fit inside
the Keltner Channel (KC), a breakout is about to occur. It works on longer
term charts, such as
15 minute to daily charts.

This code creates an indicator that plots the ratio of BB width to KC width.
When BB and KC widths are
the same, the ratio (BBS_Ind)is equal to one (1). When the BB width is less
than the KC Width (i.e. BB
fit inside KC), the BBS_Ind is less than one and a breakout is indicated.

An Alert Line is provided to indicate the level at which the trader
considers that the "sqeeze is on" and
a breakout is eminant.

Coded by Kahuna 9/10/2003

Added by eKam: 9/10/2003
The average of where price has been relative to the Donchian mid line and
Exponential average of the
same length is also plotted as an attempt to predict the direction of the
breakout.

Added 2/1/2005 For decreasing Delta bar....darker colors to highlight the
change.}

Inputs: {------------------------------------------------}
Price(Close),
Length(20), { Length for Average True Range (ATR) & Std. Deviation (SD)
Calcs }
nK(1.5), { Keltner Channel ATRs from Average }
nBB(2), { Bollinger Band Std. Devs. from Average }
AlertLine( 1 ), { BBS_Index level at which to issue alerts }
NormalColor( Red ), { Normal color for BBS_Ind }
AlertlColor( Blue ) { Color for BBS_Ind below alert line }
;
Variables: {---------------------------------------------}
ATR(0), { Average True Range }
SDev(0), { Standard Deviation }
BBS_Ind(0), { Bollinger Band Squeeze Indicator }
alertTextID(-1)
;
if barnumber = 1 and alertTextID = -1 then
alertTextID = Text_New(date,time,0,"dummy");

{-- Calculate BB Squeeze Indicator ----------------------}
ATR = AvgTrueRange(Length);
SDev = StdDev(Price, Length);
BBS_Ind = (nBB * SDev) / (nK * ATR);

If BBS_Ind < Alertline then
SetPlotColor(1, NormalColor)
else
SetPlotColor(1, AlertlColor);

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

{-- Plot delta of price from Donchina mid line ----------}
value2 = LinearRegValue(price-((Highest(H, Length)+Lowest(L, Length))/2
+
xAverage(c,Length))/2,Length,0);
var:color(0); color = yellow;
if value2>0 then
if value2 > value2[1] then
color = green
else
color = darkgreen;

if value2<0 then
if value2 < value2[1] then
color = red
else
color = darkred;

plot3(value2,"BB Squeeze",color);

{-- Issue Alert when the Squeeze is On ------------------}
if BBS_Ind crosses below AlertLine
and Text_GetTime(alertTextID) <> time then begin
text_setLocation(alertTextID, date, time, 0);
Alert("BB Squeeze Alert");
end;

{-- Issue Alert when the Squeeze Releases ---------------}
if BBS_Ind crosses above AlertLine
and Text_GetTime(alertTextID) <> time then begin
text_setLocation(alertTextID, date, time, 0);
Alert("BB Squeeze Is Over");
end;



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date: 12/16/2005