Registered User Joined: 8/21/2007 Posts: 181
|
I'd like to be able to specify a condition where the weekly close is higher than X percent of the previous 52 week closes.
For instance, I'd like to identify if the weekly close is higher than 65% of the previous 52 closes.
Is that possible?
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try using the following RealCode Condition with a Weekly Bar Interval:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Close Above
'|******************************************************************
'# Period = UserInput.Integer = 52
'# Percent = UserInput.Single = 65
Dim Count As Integer = 0
Dim Threshold As Single = Period * Percent / 100
If CurrentIndex >= Period Then
For i As Integer = 1 To Period
If Price.Last > Price.Last(i) Then
Count += 1
If Count >= Threshold Then
Pass
Exit For
End If
End If
Next
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 8/21/2007 Posts: 181
|
As always Bruce, thanks. That is perfect.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|