Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/5/2009 Posts: 191
|
When I run these two PCFs separately in two separate easy scans, each easy scan shows stocks that meet the individual PCFs criteria respectively. But when I combine the two PCFs with OR into one PCF and one easy scan, I get no stocks at all. Why is that since OR means meeting either one PCF criteria OR the other, not both?
H >= 1.07 * AVGL7.1 AND MAXH7.1 < 1.07 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) AND MINL7.1 > .93 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) (this works)
MAXH5.1 / MINL5.1 <= 1.05 AND (MAXH5.1 <= C5.1 * 1.05 AND MINL5.1 >= C5.1 * .90) (this works)
H >= 1.07 * AVGL7.1 AND MAXH7.1 < 1.07 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) AND MINL7.1 > .93 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) OR MAXH5.1 / MINL5.1 <= 1.05 AND (MAXH5.1 <= C5.1 * 1.05 AND MINL5.1 >= C5.1 * .90) (this does not work)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You need to put parentheses around the individual sub-formulas. Otherwise OR is going to get processed before AND in the order of operations.
(H >= 1.07 * AVGL7.1 AND MAXH7.1 < 1.07 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) AND MINL7.1 > .93 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1)) OR (MAXH5.1 / MINL5.1 <= 1.05 AND (MAXH5.1 <= C5.1 * 1.05 AND MINL5.1 >= C5.1 * .90))
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/18/2012 Posts: 40
|
Have you tried
(H >= 1.07 * AVGL7.1 AND MAXH7.1 < 1.07 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) AND MINL7.1 > .93 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1))
OR
(MAXH5.1 / MINL5.1 <= 1.05 AND (MAXH5.1 <= C5.1 * 1.05 AND MINL5.1 >= C5.1 * .90))?
I added brackets around each expression to avoid confusion about AND OR sequence
Just a thought, I haven't tried it
|
|
Registered User Joined: 7/5/2009 Posts: 191
|
Thanks so much Bruce! That did the trick!
|
|
Registered User Joined: 7/5/2009 Posts: 191
|
One final question on this Bruce. If I wanted to add this PCF:
MAXH10.1 / MINL10.1 <= 1.05 AND (MAXH10.1 <= C10.1 * 1.05 AND MINL10.1 >= C10.1 * .90)
To this PCF using OR:
(H >= 1.07 * AVGL7.1 AND MAXH7.1 < 1.07 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) AND MINL7.1 > .93 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1)) OR (MAXH5.1 / MINL5.1 <= 1.05 AND (MAXH5.1 <= C5.1 * 1.05 AND MINL5.1 >= C5.1 * .90))
Would this be correct?
(H >= 1.07 * AVGL7.1 AND MAXH7.1 < 1.07 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1) AND MINL7.1 > .93 * ((AVGH7.1 - AVGL7.1) / 2 + AVGL7.1)) OR (MAXH5.1 / MINL5.1 <= 1.05 AND (MAXH5.1 <= C5.1 * 1.05 AND MINL5.1 >= C5.1 * .90)) OR (MAXH10.1 / MINL10.1 <= 1.05 AND (MAXH10.1 <= C10.1 * 1.05 AND MINL10.1 >= C10.1 * .90))
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, that should be correct.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |