Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

RWB Code Support Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
danielbender
Posted : Tuesday, December 27, 2016 9:21:40 PM
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
Bruce_L
Posted : Wednesday, December 28, 2016 12:53:58 PM


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
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.