Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Code Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
hakim2
Posted : Friday, October 30, 2009 2:06:03 PM
Registered User
Joined: 3/5/2005
Posts: 7
How could I write the code for the following rule and use it as a filter for a watch list? 

Find all the stocks that for the last two days their close was higher than their open
and the open of yesterday was above the close of the day before yesterday.
Bruce_L
Posted : Friday, October 30, 2009 2:09:29 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Please try the following RealCode Rule (you can Drag and Drop it into the Filter to use it as a Filter):

If Price.Last > Price.Open AndAlso _
    Price.Last(1) > Price.Open(1) AndAlso _
    Price.Open(1) > Price.Last(2) Then Pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
hakim2
Posted : Friday, October 30, 2009 2:34:05 PM
Registered User
Joined: 3/5/2005
Posts: 7
Hi,

I tried the code. It did not compile. It seems that there 
are somethibg missing. Could you check it please?

Hossein
Bruce_L
Posted : Friday, October 30, 2009 2:39:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I compiled it before I posted it. What error messages are you getting? Are you using it as RealCode Rule as indicated?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
hakim2
Posted : Friday, October 30, 2009 2:59:29 PM
Registered User
Joined: 3/5/2005
Posts: 7

 

It is working now. I had forgotten the underline at the end of each line.
What is the meaning og those underlines? Also, what is the difference
between and and AndAlso?

Thanks,

Hossein

StockGuy
Posted : Friday, October 30, 2009 3:02:10 PM

Administration

Joined: 9/30/2004
Posts: 9,187
The "space"_ tells the code that it continues on the next line.

Using andalso instead of and will speed up the code a bit. As soon as one of our conditions is false it will stop and return false.
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.