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 |

Using "Or" correctly Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
antares66
Posted : Monday, August 6, 2018 10:09:23 AM
Registered User
Joined: 4/14/2007
Posts: 37

Hello,

i wrote this formula

"100*(c-c1)/c1>10 and c>1 and c<50 or 100*(c1-c2)/c2>10 and c>1 and c<50"

to check stocks which increased more than 10% this week an the last, but it shows only
stocks from the current week. The part of the formula after "Or" doesn`t work.
What did i wrong?

Thanks
 

Bruce_L
Posted : Monday, August 6, 2018 10:50:07 AM


Worden Trainer

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

I suspect it is just an issue with your expected order of operation compared to the actual order of operations. OR has a higher priority than AND. This means OR gets evaluated prior to AND unless you force the order of operations with parentheses.

(100 * (C - C1) / C1 > 10 AND C > 1 AND C < 50) OR (100 * (C1 - C2) / C2 > 10 AND C > 1 AND C < 50)

You could shorten this somewhat to the following without having to use OR at all.

1 < C AND C < 50 AND CountTrue(10 * C > 11 * C1, 2) > 0



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
antares66
Posted : Monday, August 6, 2018 2:45:04 PM
Registered User
Joined: 4/14/2007
Posts: 37

Thanks Bruce

Bruce_L
Posted : Monday, August 6, 2018 3:32:43 PM


Worden Trainer

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

You're welcome.



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