TC2000 Help SitePersonal Criteria Formulas (PCF) PCF SyntaxBoolean Relational Operators and Functions Table

# Boolean Relational Operators and Functions Table

Boolean relational operators is just a fancy name for comparing two numeric values or indicators in order to convert those numeric values into a Boolean (true or false) result instead.

Since this is how we convert indicators into conditions, a Condition Formula is going to always have at least one Boolean relational operator or Function in it.

The three basic Boolean relational operators are > (greater than) which checks for whatever is before it to be higher than whatever is after it to return true, < (less than) which is the reverse and checks for whatever is bofer it to be lower than whatever is after it to return true, and = (equal to) which checks for the values on both sides to be exactly the same in order to return true.

The other three operators are just combinations of these three basic operators. You are essentially checking both of the relational operators and using an implied OR so that the result is true if either of the relational operators would have returned true.

The >= sign (greater than or equal to) returns true both when the left is above the right and when the both sides are exactly the same. The <= sign (less than or equal to) returns true both when the left is below the right and when both sides are exactly the same. The <> sign (not equal to) only returns true when both sides are different.

So C <> O is just a shorter way of writing C < O OR C > O without using a Boolean logical operator.

 Greater Than (Boolean relational operator) `v > w` `v`=Numeric, `w`=Numeric Greater Than or Equal To (Boolean relational operator) `v >= w` Less Than (Boolean relational operator) `v < w` Less Than or Equal To (Boolean relational operator) `v <= w` Equal To (Boolean relational operator) `v = w` Not Equal To (Boolean relational operator) `v <> w`

There are also special functions which work in a similar fashion to Boolean relational operators in that two numeric values are compared to return a Boolean (true or false) result.

These functions add a time factor however in that the values are compared both as currently calculated and when calculated a number of bars ago. By default it just compares the current values and the previous values from one bar ago, but you can set a Period to compare the current values and previous values from Period bars ago instead.

This is similar to combining one of the three basic Boolean relational operators above in that it is a shortcut to making two comparisons without using a Boolean Logical operator.

The XUP() function checks for the first argument to be at or above the second argument currently but below previously. So XUP(C, AVGC10) is the same as the much longer C >= AVGC10 AND C1 <= AVGC10.1 formula.

The XDOWN() function checks for the first argument to be at or below the second argument currently but above previously. So XDOWN(C, 5) is the same as the much longer C <= 5 AND C1 > 5 formula.

 Returns true when v is greater than w at x bars ago and v is less than or equal to w now. x defaults to 1 if not supplied. `XDOWN(v, w, x)` `v`=Numeric, `w`=Numeric, `x`=Period Returns true when v is less than w at x bars ago and v is greater than or equal to w now. x defaults to 1 if not supplied. `XUP(v, w, x)`