| Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
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
|
|
 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
|
|

 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
|
|
Registered User Joined: 1/3/2008 Posts: 20
|
Perfect! Thank you both.
|
|

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