Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/2/2009 Posts: 27
|
I was wondering if you could show me how to accomplish this objective...
I want to be able to scan through a list of stocks in real-time on the 5 minute chart for symbols that have the 8SMA above the 10SMA, the 10SMA above the 20SMA, the 20SMA above the 24SMA, the 24SMA above the 50SMA, the 50SMA above the 100SMA, and the 100SMA above the 200SMA.
Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could Save the following RealCode Condition, Load it as a WatchList Column, change the Bar Interval for that WatchList Column to 5-Minutes and use it as a Scan.
Writing Conditions in RealCode
Saving Your Work
Scanning with Conditions
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908
'|******************************************************************
If CurrentIndex >= 199 Then
If Price.AVGC(8) > Price.AVGC(10) AndAlso _
Price.AVGC(10) > Price.AVGC(20) AndAlso _
Price.AVGC(20) > Price.AVGC(24) AndAlso _
Price.AVGC(24) > Price.AVGC(50) AndAlso _
Price.AVGC(50) > Price.AVGC(100) AndAlso _
Price.AVGC(100) > Price.AVGC(200) Then
Pass
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/2/2009 Posts: 27
|
Ok thanks, I forgot though that I only want to deal with stocks that are between $30 and $70 dollars. How would I add that into the equation?
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908 Up Trend
'|******************************************************************
If CurrentIndex >= 199 Then
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
Price.AVGC(8) < Price.AVGC(10) AndAlso _
Price.AVGC(10) < Price.AVGC(20) AndAlso _
Price.AVGC(20) < Price.AVGC(24) AndAlso _
Price.AVGC(24) < Price.AVGC(50) AndAlso _
Price.AVGC(50) < Price.AVGC(100) AndAlso _
Price.AVGC(100) < Price.AVGC(200) Then
Pass
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/2/2009 Posts: 27
|
Sorry I'm a little confused....
I have my watchlist up, and I clicked on "New Real Code Condition" and copied and pasted this formula....
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908 Up Trend
'|******************************************************************
If CurrentIndex >= 199 Then
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
Price.AVGC(8) < Price.AVGC(10) AndAlso _
Price.AVGC(10) < Price.AVGC(20) AndAlso _
Price.AVGC(20) < Price.AVGC(24) AndAlso _
Price.AVGC(24) < Price.AVGC(50) AndAlso _
Price.AVGC(50) < Price.AVGC(100) AndAlso _
Price.AVGC(100) < Price.AVGC(200) Then
Pass
End If
Else
SetIndexInvalid
End If
Then I pressed Ok.
But I didn't see in my watchlist any colored bars under the ticker to show me that the formula was true.
Can you please tell me what I did wrong?
Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Creating a Condition doesn't mean the Condition is being used to do anything. If you want the Colored Bars in the WatchList, you need to Scan with the Condition. One way to do so would be to right-click on the Condition and select Scan. The Scanning with Conditions video referenced earlier explores this in more detail.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/2/2009 Posts: 27
|
Thanks but I would like to simultaneously search for stocks in an uptrend (using the above formula) but also would like to search for stocks in a downtrend. I realize that all i would have to do is change the < to > .
So how would I be able to scan my watchlist for both conditions at the same time?
Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You could create a second Condition for the Down Trend:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908 Down Trend
'|******************************************************************
If CurrentIndex >= 199 Then
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
Price.AVGC(8) < Price.AVGC(10) AndAlso _
Price.AVGC(10) < Price.AVGC(20) AndAlso _
Price.AVGC(20) < Price.AVGC(24) AndAlso _
Price.AVGC(24) < Price.AVGC(50) AndAlso _
Price.AVGC(50) < Price.AVGC(100) AndAlso _
Price.AVGC(100) < Price.AVGC(200) Then
Pass
End If
Else
SetIndexInvalid
End If
And then Drag and Drop the Conditions onto each other to create a Combo Condition (with Or between the Conditions instead of And).
Creating Conditions
You could also just create a RealCode Condition that checks for both possibilties:
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908 Trend
'|******************************************************************
If CurrentIndex >= 199 Then
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
((Price.AVGC(8) > Price.AVGC(10) AndAlso _
Price.AVGC(10) > Price.AVGC(20) AndAlso _
Price.AVGC(20) > Price.AVGC(24) AndAlso _
Price.AVGC(24) > Price.AVGC(50) AndAlso _
Price.AVGC(50) > Price.AVGC(100) AndAlso _
Price.AVGC(100) > Price.AVGC(200)) OrElse _
(Price.AVGC(8) < Price.AVGC(10) AndAlso _
Price.AVGC(10) < Price.AVGC(20) AndAlso _
Price.AVGC(20) < Price.AVGC(24) AndAlso _
Price.AVGC(24) < Price.AVGC(50) AndAlso _
Price.AVGC(50) < Price.AVGC(100) AndAlso _
Price.AVGC(100) < Price.AVGC(200))) Then
Pass
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/2/2009 Posts: 27
|
When I scan my watchlist for stocks that are between $30 and $70 in an uptrend with this formula, It works. Here is the formula.....
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908
'|******************************************************************
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
Price.AVGC(8) > Price.AVGC(10) AndAlso _
Price.AVGC(10) > Price.AVGC(20) AndAlso _
Price.AVGC(20) > Price.AVGC(24) AndAlso _
Price.AVGC(24) > Price.AVGC(50) AndAlso _
Price.AVGC(50) > Price.AVGC(100) AndAlso _
Price.AVGC(100) > Price.AVGC(200) Then Pass
But when I try to scan for stocks in my watchlist between $30 - $70 in a downtrend using this formula, It doesn't seem to do anything. The system won't scan for it. Is there something wrong with the formula?
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908
'|******************************************************************
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
Price.AVGC(8) < Price.AVGC(10) AndAlso _
Price.AVGC(10) < Price.AVGC(20) AndAlso _
Price.AVGC(20) < Price.AVGC(24) AndAlso _
Price.AVGC(24) < Price.AVGC(50) AndAlso _
Price.AVGC(50) < Price.AVGC(100) AndAlso _
Price.AVGC(100) < Price.AVGC(200) Then Pass
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try using the following instead. It uses SetIndexInvalid so it doesn't return any results until the calculations are valid to help the WatchList autosize the amount of data used (all previous RealCode above your most recent post has been adjusted to use this as well).
'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:joemcc572004 48908 Down Trend
'|******************************************************************
If CurrentIndex >= 199 Then
If 30 <= Price.Last AndAlso _
Price.Last <= 70 AndAlso _
Price.AVGC(8) < Price.AVGC(10) AndAlso _
Price.AVGC(10) < Price.AVGC(20) AndAlso _
Price.AVGC(20) < Price.AVGC(24) AndAlso _
Price.AVGC(24) < Price.AVGC(50) AndAlso _
Price.AVGC(50) < Price.AVGC(100) AndAlso _
Price.AVGC(100) < Price.AVGC(200) Then
Pass
End If
Else
SetIndexInvalid
End If
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/2/2009 Posts: 27
|
Thanks, but I used that formula, and it works sometimes, and other times it won't scan my watchlist at all. I don't know why but when I link it to my watchlist and try scanning, nothing happens. It seems like its picky, can you tell me why that is?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No, I couldn't say why it doesn't work consistently on your computer. Technical support is not provided in the forums.
It always works on my computer without any issues at all.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |