| Welcome Guest, please  sign in  to participate in a discussion. | Search | 	Active Topics | | 
	
	
	
	| Registered User Joined: 7/17/2013
 Posts: 2
 
 | 
 What formula would I use to scan for stocks who's price intersected the lower Bollinger band X number of periods before? 
 Thanks. | 
	|  | 
	
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	I would need to know the settings of the Bollinger Band and the value of X to help you create such a forrmula. For example, for a Simple Bollinger Band 20,2.00 of 5 bars ago, a Condition Formula could be written as: 
	ABS(AVGC20.5 - 2 * SQR(ABS(C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2 + C20 ^ 2 + C21 ^ 2 + C22 ^ 2 + C23 ^ 2 + C24 ^ 2 - 20 * AVGC20.5 ^ 2) / 20) - (H5 + L5) / 2) <= (H5 - L5) / 2 
	Modelling Bollinger Bands (& Standard Deviation) in a TC PCF 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	|  | 
	
	
	| Registered User Joined: 6/27/2013
 Posts: 4
 
 | 
	What if X = 1 (previous period)? How does the formula change? 
	  
	I plan on creating a recent range to scan for using the OR operator. Once I see X=1, I can take it from there. Took a look at your link, but I"m afraid that didn't help.  
	Thanks, 
	Ron 
	  
	  | 
	|  | 
	
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	If X is 1 instead of 5, you would need to subtract 4 from all of the bars ago parameters. 
	ABS(AVGC20.1 - 2 * SQR(ABS(C1 ^ 2 + C2 ^ 2 + C3 ^ 2 + C4 ^ 2 + C5 ^ 2 + C6 ^ 2 + C7 ^ 2 + C8 ^ 2 + C9 ^ 2 + C10 ^ 2 + C11 ^ 2 + C12 ^ 2 + C13 ^ 2 + C14 ^ 2 + C15 ^ 2 + C16 ^ 2 + C17 ^ 2 + C18 ^ 2 + C19 ^ 2 + C20 ^ 2 - 20 * AVGC20.1 ^ 2) / 20) - (H1 + L1) / 2) <= (H1 - L1) / 2 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	|  | 
	
	
	| Registered User Joined: 6/27/2013
 Posts: 4
 
 | 
	Thanks. However, if I can make one small correction to your two formulas. To show where price crosses the lower BB, it should be: ABS(AVGC20.1 - ... not  ABS(AVGC20.1 +...  
	The formulas above are for when price crosses the upper BB. 
	All the best, 
	Ron 
	  | 
	|  | 
	
	
	|  
  Worden Trainer
 
 Joined: 10/7/2004
 Posts: 65,138
 
 | 
	Yes, the first operator in the formulas should be a - sign and not a + for the lower band. 
 -Bruce
 Personal Criteria Formulas
 TC2000 Support Articles
 | 
	|  | 
| Guest-1 |