Author Topic: BB squeeze code needed  (Read 5524 times)

bharatk8

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
BB squeeze code needed
« on: September 28, 2010, 09:54:07 am »
I want to find squeeze in Bollinger Band.Pl. see image.Pl. provide code that works.

bharatk8

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: BB squeeze code needed
« Reply #1 on: September 28, 2010, 09:55:38 am »
I could not attatch this image with 1st post.

bharatk8

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: BB squeeze code needed
« Reply #2 on: September 28, 2010, 09:58:22 am »
I could not attatch this image with 1st post.Pl. suggest new code.I have also tried (BBtop-BBbotom)/BB median too.But some how it  is also having glitches similar to this code .

administrator

  • Administrator
  • Full Member
  • *****
  • Posts: 200
    • View Profile
Re: BB squeeze code needed
« Reply #3 on: September 28, 2010, 07:21:29 pm »
Have you looked at the following code http://www.wisestocktrader.com/indicators/646-bollinger-band-squeeze-expansion it looks like what you need.

bharatk8

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: BB squeeze code needed
« Reply #4 on: September 29, 2010, 06:56:58 pm »
pl. add exploration code in it

jose

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: BB squeeze code needed
« Reply #5 on: September 29, 2010, 07:05:51 pm »
Hello

I'll take take a crack at it
Code: [Select]
_SECTION_BEGIN("Bollinger Bands");
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
//SetBarFillColor( IIf( C>O, colorGreen, colorRed ) );
Plot( C, "Close", colorBlack, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
bbtop=BBandTop( P, Periods, Width );
bbbot=BBandBot( P, Periods, Width );
Plot(bbtop, "BBTop" + _PARAM_VALUES(), Color, Style );
Plot(bbbot , "BBBot" + _PARAM_VALUES(), Color, Style );
diff=bbtop-bbbot;

sqeezcolor=ColorRGB(194,220,218);
expandcolor=ColorRGB(255,220,218);
PlotOHLC( bbtop,bbtop, bbbot,bbbot, "Price chart shifted 10% up",IIf(((diff/bbtop)*100)<12,sqeezcolor,expandcolor), styleCloud );

Filter = ((diff/bbtop)*100)<12;
AddTextColumn(Name(), "Stock Name");

// Plot( diff, "Diff", colorGreen, Style );
_SECTION_END();

Regards,
Jose

bharatk8

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: BB squeeze code needed
« Reply #6 on: September 30, 2010, 06:44:13 pm »
still not getting it right.Pl. see image.Pl. help

administrator

  • Administrator
  • Full Member
  • *****
  • Posts: 200
    • View Profile
Re: BB squeeze code needed
« Reply #7 on: September 30, 2010, 08:27:46 pm »
Hello

The code that jose gave you works I just checked it. You must be doing something wrong.

bharatk8

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: BB squeeze code needed
« Reply #8 on: October 01, 2010, 01:20:43 am »
I found an alternative way to code it.Just added following lines in my existing BB code.Top,Bot,Mid are name  mentioned in my old code for BB lines.               

Squeeze=(Top-Bot)/Mid;
AddColumn(squeeze, "squeeze", 1.2, IIf(squeeze,colorGreen,colorWhite));

I click on out put window to get results in ascending order and start checking charts with tightest squeeze onwards.