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 |

RealCode rule for Williams %R Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
stkhunter
Posted : Wednesday, June 10, 2009 7:23:55 PM
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

Bruce_L
Posted : Thursday, June 11, 2009 7:46:48 AM


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
stkhunter
Posted : Thursday, June 11, 2009 10:19:37 AM
Registered User
Joined: 10/7/2004
Posts: 7
Thanks Bruce
Bruce_L
Posted : Thursday, June 11, 2009 10:20:33 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Mark17
Posted : Monday, July 6, 2009 12:04:03 PM
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?
Michael_T
Posted : Monday, July 6, 2009 3:43:15 PM


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.
Mark17
Posted : Tuesday, July 7, 2009 2:37:07 PM
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?
Bruce_L
Posted : Tuesday, July 7, 2009 2:55:01 PM


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
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.