Registered User Joined: 7/26/2010 Posts: 14
|
Hi,can you please guide me for my first scanning condition ?Can you give please code or method for scanning a list of stocks that meet following condition:- High of last bar is highest of XX bars ago- this condition never happened within these XX bars, which means it's the first time it happens since XX bars as specified above.Thanks.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If I'm understanding the request correctly, the following RealCode Condition might do what you want:
Writing Conditions in RealCode
Scanning with Conditions
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:XX Bars High
'|******************************************************************
'# XX = UserInput.Integer = 10
Static Count As Integer
If CurrentIndex >= XX Then
If CurrentIndex >= 2 * XX Then
If Price.High(XX) > Price.MaxHigh(XX, XX + 1) Then
Count -= 1
End If
Else
SetIndexInvalid
End If
If Price.High > Price.MaxHigh(XX, 1) Then
Count += 1
If Count = 1 Then Pass
End If
Else
If isFirstBar Then
Count = 0
End If
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|