inputs:
NumATRs (1.5), Length( 20 ), NumDevsUp( 2 ),
NumDevsDn( -2 ), hlength(9), Displace( 0 ) ;
variables:
Avg( 0 ), SDev( 0 ), BLowerBand( 0 ),BUpperBand( 0 ), Shift(0),
KLowerBand( 0 ), KUpperBand( 0 ), histodiff(0);
{Bollinger Bands}
Avg = AverageFC( close, Length ) ;
SDev = StandardDev( close, Length, 1 ) ;
BUpperBand = Avg + NumDevsUp * SDev ;
BLowerBand = Avg + NumDevsDn * SDev ;
{Keltner Channel}
Shift = NumATRs * AvgTrueRange( Length ) ;
KUpperBand = Avg + Shift ;
KLowerBand = Avg - Shift;
{squeeze indicator}
setplotcolor(2,green);
if bupperband < kupperband {or blowerband < klowerband}
then setplotcolor(2,red);
plot2(0,"squeeze");
{histogram}
histodiff = averagefc(close - avg,hlength);
if histodiff > 0 then setplotcolor(3,blue);
if histodiff > 0 and histodiff < histodiff[1] then setplotcolor(3,darkblue);
if histodiff < 0 then setplotcolor(3, red);
if histodiff < 0 and histodiff > histodiff[1] then setplotcolor(3,darkred);
plot3(histodiff, "Hist");
Comment