// Downloaded From https://www.WiseStockTrader.com _SECTION_BEGIN("BB Squeeze"); 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); // { BBSqueezeex level at which to issue alerts } NormalColor = colorRed; // { Normal color for BBSqueeze } AlertlColor = colorLime; // { Color for BBSqueeze below alert line } LHMult = Nz(PointValue); //{-- Calculate BB Squeeze Indicator ----------------------} AvgTrueRange = ATR(Length); SDev = StDev(Price, Length); Denom = nK*AvgTrueRange; BBSqueeze = Nz((nBB * SDev) /Denom); SetPlotColor = IIf( BBSqueeze < Alertline, NormalColor, AlertlColor); BBcrossDown = Cross(AlertLine,BBSqueeze); BBcrossUp = Cross(BBSqueeze,AlertLine); //{-- Plot the Alert Line -------------------------} Plot(0, "", 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), colorBlue, colorSkyblue), IIf( value2 < 0, IIf( value2 < Ref(value2,-1), colorRed, colorYellow ), colorGold )); //Plot(value2*LHMult, "NickmNxtMove", color, styleHistogram ); Plot(value2,"BBSqueeze",color, styleHistogram ); //Sound alerts AlertIf( BBcrossDown, "SOUND C:\\Windows\\Media\\RINGIN.WAV", "Audio alert", 2 ); AlertIf( BBcrossUp, "SOUND C:\\Windows\\Media\\RINGIN.WAV", "Audio alert", 2 ); PlotShapes( IIf( BBcrossDown, shapeHollowCircle, shapeNone ), colorYellow, layer = 0, yposition = 0, offset = 0); PlotShapes( IIf( BBcrossUP, shapeHollowCircle, shapeNone ), colorWhite, layer = 0, yposition = 0, offset = 0); _SECTION_END();