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 |

Realcode question Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
rostifritz
Posted : Tuesday, June 2, 2009 2:58:14 PM
Registered User
Joined: 1/3/2008
Posts: 20
If I want all these conditions to be met simultaneously, do I need to have something more in the code?

If price.open(1) > ((price.high(1) + price.low(1)) / 2) Then pass
If price.close(1) > (((price.high(1) - price.low(1)) * .66) + price.low(1)) Then pass
If price.open(1) > (((price.high(1) - price.low(1)) * .30) + price.low(1)) Then pass
If price.open < (price.high(1) * 1.005) Then pass
StockGuy
Posted : Tuesday, June 2, 2009 3:05:12 PM

Administration

Joined: 9/30/2004
Posts: 9,187
If price.open(1) > ((price.high(1) + price.low(1)) / 2) andalso _
price.close(1) > (((price.high(1) - price.low(1)) * .66) + price.low(1)) andalso _
price.open(1) > (((price.high(1) - price.low(1)) * .30) + price.low(1))  andalso _
price.open < (price.high(1) * 1.005) Then pass
Bruce_L
Posted : Tuesday, June 2, 2009 3:08:15 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
rostifritz,
I'm pretty sure what you have would return True when any of the lines are True. That would create the same results as:

If price.open(1) > ((price.high(1) + price.low(1)) / 2) OrElse _
    price.close(1) > (((price.high(1) - price.low(1)) * .66) + price.low(1)) OrElse _
    price.open(1) > (((price.high(1) - price.low(1)) * .30) + price.low(1)) OrElse _
    price.open < (price.high(1) * 1.005) Then pass

What you probably want instead is:

If price.open(1) > ((price.high(1) + price.low(1)) / 2) AndAlso _
    price.close(1) > (((price.high(1) - price.low(1)) * .66) + price.low(1)) AndAlso _
    price.open(1) > (((price.high(1) - price.low(1)) * .30) + price.low(1)) AndAlso _
    price.open < (price.high(1) * 1.005) Then pass

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
rostifritz
Posted : Tuesday, June 2, 2009 3:15:58 PM
Registered User
Joined: 1/3/2008
Posts: 20
Perfect!  Thank you both.
Bruce_L
Posted : Tuesday, June 2, 2009 3:19:47 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
rostifritz,
You're welcome. Our pleasure.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
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.