What Are Condition Groups?
Condition groups, also referred to as Match Blocks, are logical sets of conditions that are evaluated together. These conditions can either be simple or nested, allowing for complex logic in strategy design. Each condition group evaluates to either true
or false
based on the conditions it contains.
A condition group enables you to define how conditions are combined and evaluated. There are two main types of combination options:
- Any: If any condition in the group is
true
, the entire group evaluates totrue
. - All: If all conditions in the group are
true
, the entire group evaluates totrue
.
Combination Types
If the group contains nested condition groups, each nested group is treated as a single condition, along with other simple or non-nested conditions.
1. Any Combinator
The Any combinator means that the group evaluates to true
if any one of its conditions is true
. If the group contains nested condition groups, each nested group is evaluated as one condition.
Let's refer to the two conditions depicted below as c1
and c2
. The combination of these two conditions forms ag1 (Any Group 1).
Condition Table for Any Combinator:
Condition c1 | Condition c2 | ag1 (Any Group 1) |
---|---|---|
True | False | True |
False | True | True |
True | True | True |
False | False | False |
2. All Combinator
The All combinator means that all conditions in the group must be true
for the group to evaluate as true
. Nested condition groups are treated as a single condition, just like other conditions.
Let's refer to the two conditions depicted below as c1
and c2
. The combination of these two conditions forms alg1 (All Group 1).
Condition Table for All Combinator:
Condition c1 | Condition c2 | alg1 (All Group 1) |
---|---|---|
True | False | False |
False | True | False |
True | True | True |
False | False | False |
3. Nested Condition Groups
Nested condition groups allow for more complex logical structures. These groups are evaluated together, and you can choose to use either the Any or All combinator for the parent group. This feature adds flexibility, enabling the creation of more nuanced strategies.
Let's refer to the four conditions as c1
, c2
, c3
, and c4
. These form two groups:
- ag1: An Any group that combines
c1
andc2
. - nalg2: A Nested All group that combines
c3
andc4
.
Condition Table for Nested Groups (Some Output Scenarios):
Condition c1 | Condition c2 | ag1 (Any Group) | Condition c3 | Condition c4 | nalg2 (Nested All Group) | Final Result |
---|---|---|---|---|---|---|
True | True | True | True | True | True | True |
True | True | True | True | False | False | False |
True | True | True | False | True | False | False |
True | True | True | False | False | False | False |
True | False | True | True | True | True | True |
True | False | True | True | False | False | False |
True | False | True | False | True | False | False |
True | False | True | False | False | False | False |
False | True | True | True | True | True | True |
False | True | True | True | False | False | False |
False | True | True | False | True | False | False |
False | True | True | False | False | False | False |
False | False | False | True | True | True | True |
False | False | False | True | False | False | False |
False | False | False | False | True | False | False |
False | False | False | False | False | False | False |
Quick Recap:
- Any: The condition group evaluates to
true
if any of its conditions aretrue
. - All: The condition group evaluates to
true
only if all conditions aretrue
. - Nested Groups: Enable more complex, layered logical conditions for enhanced flexibility.
These powerful features enable you to design highly customizable and precise strategies within the TradeOrca platform.