| 
 PureBytes Links 
Trading Reference Links 
 | 
| 
 Here is an old code I had. 
  
//Bollinger Bands with Expansion and Contraction 
//HIGHLIGHTS 
// Contraction Color: Blue 
pds= 20;//bollinger bands 
periods
shift= 2;//bollinger band shift
ChartStyle=styleCandle; 
Cond1=  BBandTop(Close,pds,shift)< Ref(BBandTop(Close,pds,shift),-1) AND
BBandBot(Close,pds,shift)>Ref(BBandBot(Close,pds,shift),-1);
  
// Expansion Color: Red 
Cond2=  BBandTop(Close,pds,shift)> Ref(BBandTop(Close,pds,shift),-1) AND
BBandBot(Close,pds,shift)<Ref(BBandBot(Close,pds,shift),-1);
barcolor= IIf(Cond1,6,IIf(Cond2,4,0));
Graph0= BBandTop(C,pds,shift);
Graph1=C; 
Graph1Color=colorBlack; 
Graph1Style=ChartStyle; 
Graph2= BBandBot(C,pds,shift);
Graph0Style=Graph2Style= 1;
Graph0BarColor=Graph2BarColor= ValueWhen(barcolor!=0,barcolor);
/**********************************************************/ 
Lookback= 10;
diff= BBandTop(Close,pds,shift)- BBandBot(Close,pds,shift);
contraction_cond= IIf(diff < Ref(LLV(diff,Lookback),-1),1,0);
expansion_cond= IIf(diff 
> Ref(HHV(diff,Lookback),-1),1,0);
present= WriteIf(Cond1,"Contraction","Expansion");//is the market currently under 
expansion or contraction
Filter=Cond1 >  0 OR Cond2 > 0 AND Close > 0 AND Close < 25 AND Volume > 5000;
AddColumn (IIf(Cond1,C,IIf(Cond2,C,C)),"close");
AddColumn (Cond1,"contract");AddColumn(ValueWhen(Cond1,BBandTop(Close,pds,shift)-BBandBot(Close,pds,shift),1),"ContractValue");
AddColumn (Cond2,"expand");AddColumn(ValueWhen(Cond2,BBandTop(Close,pds,shift)-BBandBot(Close,pds,shift),1),"ExpansionValue");
AddTextColumn (Present,"Condition");
AddColumn (RSI(),"RSI");AddColumn(ADX(),"ADX"); 
  ----- Original Message -----  
  
  
  Sent: Sunday, April 10, 2005 7:20 
PM 
  Subject: [amibroker] Re: Bollinger Bands 
  Breakout 
  
 
  Further Info:
  As indicated previously, I'm a 
  newbie. From the book "Technical  Analysis from A to Z":
  1. During 
  periods of extreme price changes (i.e high volatility),  the bands widen to 
  become more forgiving. (page 71) 2. During time of stagnant pricing (i.e. 
  low volatility), the bands  narrow to contaion prices (page 71) 3. Sharp 
  price changes tend to occur after the bands tighen, as  volatility lessens. 
  (Page 71) 4. The longer prices remain within the narrows bands the more 
  likely  a price breakout. (page 72)
  What I'd like to accomplish with 
  an Exploration is:
  1. What Tickers are in tighen bands?
  2. How 
  many days have they been in tighen bands?
  Sorry I didn't include this 
  earlier to clarify things.
 
  --- In amibroker@xxxxxxxxxxxxxxx, 
  "mccallumkeith" <keith@xxxx> wrote: >  >  > 
  Greetings, >  > I'm a newbie who is truggling to get the following 
  Exploration of  > Bollinger Bands Breakout to produce other than zero 
  results: >  > e=40;//Param("period",20,5,100,1); > 
  f1=ln(BBandTop(C,e,2)/MA(C,e)); > 
  f2=ln(BBandTop(C,e*2,2)/MA(C,e*2)); > 
  f3=ln(BBandTop(C,e*3,2)/MA(C,e*3)); >  > 
  Plot(f1,"quick",1,1); > Plot(f2,"med",colorRed,1); > 
  Plot(f3,"slow",colorBlue,1); >  > Filter=f1<f2 AND f2<f3 AND 
  f1<0.02; > AddColumn(f1,"quick",1.5); > 
  AddColumn(MA(V,100)*MA(C,100),"dollarvolume",1.0); > 
  AddColumn(MA(Filter,20),"length",1.2); >  > Your valuable 
  assistance is appreciated. >  > 
  Thanks
 
 
 
 
  Please note that this group is for 
  discussion between users only.
  To get support from AmiBroker please 
  send an e-mail directly to  SUPPORT {at} amibroker.com
  For other 
  support material please check also: http://www.amibroker.com/support.html
 
 
  
  
    
  No virus found in this incoming message. Checked by AVG 
  Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.5 - Release Date: 
  4/7/2005
  
  
Please note that this group is for discussion between users only. 
 
To get support from AmiBroker please send an e-mail directly to  
SUPPORT {at} amibroker.com 
 
For other support material please check also: 
http://www.amibroker.com/support.html 
 
  
 
 
Yahoo! Groups Links 
 |  
 No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.5 - Release Date: 4/7/2005
 
 |