Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/4/2005 Posts: 55
|
I would like to test stocks for the common double bottom ("W") pattern. I would like for RealCode to test for new lows that are equal, or are within 1% of each other, in a timeframe of four to 25 days of each other.
Ed
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The following uses a low surrounded by 3 higher lows on both sides to identify a "low". I'm guessing you will probably want to modify the requirements somewhat after looking at the results. Some of the stuff looks pretty good, but having two "lows" within 1% of each other 4 to 25 bars apart also finds quite a few patterns which don't look like a W.
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:W Pattern
'|******************************************************************
Static Pivots As New List(Of Integer)
If Price.Count >= 32 Then
If isFirstBar Then
Pivots.Clear
End If
If CurrentIndex >= 6 Then
If Price.Low(3) < Price.MinLow(3) AndAlso _
Price.Low(3) < Price.MinLow(3, 4) Then
Pivots.Insert(0, CurrentIndex + 3)
If Pivots.Count > 1 Then
For i As Integer = 1 To Pivots.Count - 1
If Pivots(i) < CurrentIndex - 25 Then
Exit For
End If
If Price.Low(Pivots(i)) <= 1.01 * Price.Low(3) AndAlso _
Price.Low(3) <= 1.01 * Price.Low(Pivots(i)) Then
Pass
Exit For
End If
If Price.Low(Pivots(i)) < Price.Low(3) Then
Exit For
End If
Next
End If
End If
End If
If isLastBar Then
Pivots.Clear
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/4/2005 Posts: 55
|
Bruce,
Thank you for coding my request. As you mention, there are a number of unwanted patterns that also show, so as you recommend, I will need to do some modifying of the requirements, but at least this gets me started.
Again, thanks...
Ed
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |