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 |

Having trouble with a pcf formula Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
mc7e
Posted : Wednesday, October 10, 2012 9:35:13 AM
Registered User
Joined: 3/8/2005
Posts: 23

I'm having  trouble getting this PCF to work. I note the first or second part work alone but together they produce nothing. Could you tell me where I went wrong?

H=maxh30 and H1<maxh29.1 and H2<maxh28.2 and H3<maxh27.3 and H4<maxh26.4 and H5<maxh25.5 and H6<maxh24.6 and h7<maxh23.7 and h8<maxh22.8 and h9<maxh21.9 and h10<maxh20.10 and h11<maxh19.11 and h12<maxh18.12 and h13<maxh17.13 and h14<maxh16.14 and h15<maxh15.15 and h16<maxh14.16 and h17<maxh13.17 and h18<maxh12.18 and h19<maxh11.19 and h20<maxh10.20 or 

 
H1=maxh29.1 and H2<maxh28.2 and H3<maxh27.3 and H4<maxh26.4  and H5<maxh25.5 and H6<maxh24.6 and h7<maxh23.7 and h8<maxh22.8 and h9<maxh21.9 and h10<maxh20.10 and h11<maxh19.11 and h12<maxh18.12 and h13<maxh17.13 and h14<maxh16.14 and h15<maxh15.15 and h16<maxh14.16 and h17<maxh13.17 and h18<maxh12.18 and h19<maxh11.19 and h20<maxh10.20
Bruce_L
Posted : Wednesday, October 10, 2012 9:53:11 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

The issue is that H1 < MAXH29.1 can't be true because H1 is part of MAXH29.1 (and the same issue continues with all of the rest of the terms).

You probably want something more like the following:

((H = MAXH30 AND H1 < MAXH28.2) OR H1 = MAXH29.1) AND H2 < MAXH27.3 AND H3 < MAXH26.4 AND H4 < MAXH25.5 AND H5 < MAXH24.6 AND H6 < MAXH23.7 AND H7 < MAXH22.8 AND H8 < MAXH21.9 AND H9 < MAXH20.10 AND H10 < MAXH19.11 AND H11 < MAXH18.12 AND H12 < MAXH17.13 AND H13 < MAXH16.14 AND H14 < MAXH15.15 AND H15 < MAXH14.16 AND H16 < MAXH13.17 AND H17 < MAXH12.18 AND H18 < MAXH11.19 AND H19 < MAXH10.20 AND H20 < MAXH9.21

PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
mc7e
Posted : Wednesday, October 10, 2012 10:47:20 AM
Registered User
Joined: 3/8/2005
Posts: 23

Thanks Bruce, but I'm a little confused with your use of parentheses. You use two at the beginning and only one thereafter. That's probably just a typo. But then, why would you use parentheses at all in this formula?  It doesn't seem to change anything.   Additionally, I've found that even after making the other changes, the formula before the 'or' and the formula after the 'or' produce different results which aren't combined when I use the 'or'. 

mc7e
Posted : Wednesday, October 10, 2012 10:48:34 AM
Registered User
Joined: 3/8/2005
Posts: 23

Oops!  I'm sorry. I missed the second parentheses.

Bruce_L
Posted : Wednesday, October 10, 2012 11:55:13 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

Order of operations:

*,/
+,-
>,>=,<,<=,=,<>
OR
AND

() -> Parentheses will force an operation to perform earlier in the order.

So if you want ANDs to be processed before ORs, you need to use parantheses to force the order of operations.



-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.