Registered User Joined: 1/14/2006 Posts: 436 
	 | 
	
		 
	Bruce 
	Hope this email finds you well.  I need a quick code fix.  The following code is plotting zero, regardless of the stocks actual behavior.  Thanks. Dan 
	  
	'|****************************************************************** 
	'|*** StockFinder RealCode Indicator - Version 5.1 www.worden.com  
	'|*** Copy and paste this header and code into StockFinder ********* 
	'|*** Indicator:RWBCount 
	'|*** Example: plot = price.close - price.close(1) 
	'|****************************************************************** 
	  
	  
	Static RWBCount As Integer 
	Dim PeriodDef(6) As Integer 
	  
	If isFirstBar Then 
	PeriodDef(1) = 3 
	PeriodDef(2) = 5 
	PeriodDef(3) = 8 
	PeriodDef(4) = 10 
	PeriodDef(5) = 12 
	PeriodDef(6) = 15 
	End If 
	  
	RWBCount = 0 
	  
	For i As Integer = 1 To 5 
	If price.AVG(PeriodDef(i)) >= Price.AVG(PeriodDef(i + 1)) Then 
	RWBCount += 1 
	End If 
	Next 
	  
	Plot = RWBCount 
	 | 
	
	
		 
   Worden Trainer
  Joined: 10/7/2004 Posts: 65,138 
	 | 
	
		 
	You need to use Static when you want the value to be remembered from one bar to the next. If you don't need this, you can use Dim instead. 
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.1 www.worden.com 
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:RWBCount
'|******************************************************************
 
Dim RWBCount As Integer = 0
Static PeriodDef(6) As Integer
 
If isFirstBar Then
	PeriodDef(1) = 3
	PeriodDef(2) = 5
	PeriodDef(3) = 8
	PeriodDef(4) = 10
	PeriodDef(5) = 12
	PeriodDef(6) = 15
End If
 
For i As Integer = 1 To 5
	If price.AVG(PeriodDef(i)) >= Price.AVG(PeriodDef(i + 1)) Then
		RWBCount += 1
	End If
Next
 
Plot = RWBCount 
  -Bruce Personal Criteria Formulas TC2000 Support Articles
	 |