How to design your own Condition Formulas
Basic condition formulas convert indicator formulas and numbers into Boolean (true or false) results by comparing two indicators formulas or numbers to each other.
The Boolean Relational Operators and Functions Table has two lists with all of the types of comparisons which are built into the Personal Criteria Formula Language. The tables work the same way as tables used to create and provide the syntax for indicator formulas.
1. Combine Indicator Formulas with Boolean Relational Operators
To create a Condition Formula for the close being greater than the open use the template for greater than. As with the mathematical operators and functions, you may not actually need to use the templates, but the table (linked above in blue) is still a good reference for the exact syntax used in the Personal Criteria Formula Language.
|Greater Than (Boolean relational operator)
w produces the following Condition Formula.
C > O
The functions for crossing down and crossing up can be quite useful and work a very similar fashion to the basic Boolean relation operators.
|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.
|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.
You can use this to check for price crossing up through 5.
But it is just as easy to check for price crossing up through a basic indicator formula such as the indicators built into the Personal Criteria Formula Language like a 10 period simple moving average.
As to check for a more complex indicator formulas crossing each other such as indicators which might require an indicator template to create a 20 period moving linear regression crossing up through Tilson T3 with a period of 10 and a volume factor of 0.7.
XUP(3 * FAVGC20 - 2 * AVG20, -(.7 ^ 3) * XAVG(XAVG(XAVG(XAVG(XAVG(XAVGC10, 10), 10), 10), 10), 10) + 3 * ((.7 ^ 2) + (.7 ^ 3)) * XAVG(XAVG(XAVG(XAVG(XAVGC10, 10), 10), 10), 10) - (6 * (.7 ^ 2) + 3 * (.7 + (.7 ^ 3))) * XAVG(XAVG(XAVG(XAVGC10, 10), 10), 10) + (1 + 3 * .7 + (.7 ^ 3) + 3 * (.7 ^ 2)) * XAVG(XAVG(XAVGC10, 10), 10))
The formula looks a lot more complex, but it is created the same way. Create both indicators using their individual templates and substitute one indicator formula for
v and the other indicator formula for
w in the template.
2. Combine Condition Formulas with Boolean Logical Operators
A condition formula doesn't have to be a simple comparison of two indicators or values however.
You can combine multiple condition formulas into a single condition formula using Boolean logical operators such as AND and OR.
If we take the
XUP(C, 5) condition formula we created above for example, another way to write this would be the following.
C >= 5 AND C1 < 5
This would be true only if price is greater than or equal to 5 currently but closed at less than 5 during the previous bar.
Note: You can combine many smaller condition formulas to create a single condition formula. This is done fairly frequently in condition formulas for candlestick patterns.