Parentheses
Here we describe the use of parentheses in the Composer of Trading Conceiver.
First we introduce the operator precedence concept.
Then we show how to use parentheses in the Composer of Trading Conceiver.
Finally, some examples of application are proposed.
Operator Precedence
All logical operators of Trading Conceiver described in the previous chapter, have the same precedence. This means that they are applied in the order they are encountered. In the Composer they are applied from top to bottom. In general, however, you want full control of the order in which they are applied, because by changing the order, the logic is completely different. A simple mathematical example:1 + (2 · 3) = 7 (1 + 2) · 3 = 9
Parentheses
You can control the order of expression execution through the use of parentheses. Operators, with their input arguments, in inner parentheses, will be executed first. The process is repeated up the hierarchy, always inner parentheses first. Parentheses can be nested. To activate a parenthesis, click it. To deactivate it, click it again.Matching Parentheses
Obviously, parentheses must be matched. The same number of left and right parentheses must appear. If not, a warning is shown. You must explicitly click the parentheses buttons to activate or deactivate them. However, in the tabsStop loss Take profitthe behavior is slightly different, to facilitate the user. In these two tabs there are fewer possible combinations, so you need to click only once the desired parenthesis, to select or deselect it, and the matching parenthesis is managed automatically.
Colors
In order to make operators and arguments of parentheses more visible, the background is colored according to the parentheses. You can select the color of inner and outer parentheses by clicking on the corresponding button in theColors
pane.
Examples of Application
Priority
Suppose you are considering 4 algorithms to decide when to go long. One of your algorithms is theWhite CandleYou want to go long only on a white candle, and this is of priority importance for you. Another algorithm you are considering very important is the
∆DI positiveYou deem the other two of less importance:
- Stochastic greater than threshold - MACD Histogram positiveYou don't care about which of the last two is true, it is just enough for one of them to be. But you want the
∆DI positive
to be true in any way.
In this case you can use the parentheses, and the operators, as shown in the picture.
The less important algorithms are enclosed in their own matching parentheses and ORed together.
Then you AND the resulting signal with the ∆DI positive
output.
Finally, you AND such result with the White Candle
algorithm.
In this particular example the outer parentheses would not be strictly necessary,
but it is always a good norm to explicitly select them, and not to rely on operator precedence.
At Least 2
TheAt least 2
operator, together with its arguments, must always be put between parentheses if another operator appears in the same tab.
In the example, you want to enter a long position only on white candles, and when at least 2 of the other algorithms are true.