Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 7
|
Can somebody help me? I am trying to set up a RealCode rule based on the Williams % R indicator. I imported the indicator into the RealCode editor and would like to write a condition the would scan for stocks that the price.close was < -20 and the price.close the last 2 or more days is >-20. I am not a programmer so although this may seem simple to many of you, I find it challenging. Thanks for your help.
Don
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Your Dragged and Dropped Williams %R Indicator should look something like the first line of the following RealCode Rule:
'# WPR = indicator.WilliamsPercentR
If WPR.Value < -20 AndAlso _
WPR.Value(1) > -20 AndAlso _
WPR.Value(2) > -20 Then Pass
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 7
|
Thanks Bruce
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/1/2009 Posts: 97
|
I right clicked in the Williams %R pane and selected "create new rule with RealCode." I gave it a test name and then dragged the Williams %R indicator into the RC window. I pasted the last three lines from above. When I now look for the rule, I can't find it. In case it never got saved, I went back, did it again, but cannot save; since it references indicators in the chart, the error message says the entire chart must be saved.
Must I save the chart before I can even see how the rule plays out on the chart?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 710
|
I did the same and the rule bubble shows on the bottom of my price chart pane and is fully functional. You do not need to save the chart for the rules to work.
|
|
Registered User Joined: 7/1/2009 Posts: 97
|
Sorry Michael--I do see the rule bubble in the top [price chart] pane. I had expected and was looking for it in the bottom Williams %R pane.
How would you now alter the RealCode to detect stocks with a current bar Williams %R > -20 but not > -20 over the last n bars and stocks with a current bar Williams %R or < -80 but not < -80 over the last n bars?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (Mark17) How would you now alter the RealCode to detect stocks with a current bar Williams %R > -20 but not > -20 over the last n bars and stocks with a current bar Williams %R...
'# WPR = indicator.WilliamsPercentR
'# nBars = UserInput.Integer = 5
Static Count As Integer
If CurrentIndex <= nBars Then SetIndexInvalid
If WPR.Value > -20 Then
If Count >= nBars Then Pass
Count = 0
Else
Count += 1
End If
QUOTE (Mark17) ...or < -80 but not < -80 over the last n bars?
'# WPR = indicator.WilliamsPercentR
'# nBars = UserInput.Integer = 5
Static Count As Integer
If CurrentIndex <= nBars Then SetIndexInvalid
If WPR.Value < -80 Then
If Count >= nBars Then Pass
Count = 0
Else
Count += 1
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |