| Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Platinum Customer
Joined: 3/31/2006 Posts: 3,207
|
Guys
How can I write a RC to screen for stocks that have 1 or 2 days of trading history?
thx
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Replacing everything after the Inherits line in the Class tab of a RealCode Condition with the following should probably work (you may need to add a '# Cumulative line, but I doubt it - in my testing this is quite slow).
Sub New
AutoLoop = False
End Sub
Public Overrides Sub CallUserCode()
If Price.Bar.Count = 2 OrElse Price.Bar.Count = 1 Then
AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), True)
Else
AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), False)
End If
End Sub
End Class
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 3/31/2006 Posts: 3,207
|
thx
and if I need to screen for IPO's 3 and 4 days ago what do I need to adjust
Sub New
AutoLoop = False
End Sub
Public Overrides Sub CallUserCode()
If Price.Bar.Count = 2 OrElse Price.Bar.Count = 1 Then
AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), True)
Else
AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), False)
End If
End Sub
End Class
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The following should work for up to four days:
Sub New
AutoLoop = False
End Sub
Public Overrides Sub CallUserCode()
If Price.Bar.Count <= 1 AndAlso Price.Bar.Count <= 4 Then
AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), True)
Else
AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), False)
End If
End Sub
End Class
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Platinum Customer
Joined: 3/31/2006 Posts: 3,207
|
thx
|
|

 Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
|
Guest-1 |