Help
Condition Group

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 to true.
  • All: If all conditions in the group are true, the entire group evaluates to true.

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 c1Condition c2ag1 (Any Group 1)
TrueFalseTrue
FalseTrueTrue
TrueTrueTrue
FalseFalseFalse
Any Combinator Example

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 c1Condition c2alg1 (All Group 1)
TrueFalseFalse
FalseTrueFalse
TrueTrueTrue
FalseFalseFalse
All Combinator Example

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 and c2.
  • nalg2: A Nested All group that combines c3 and c4.
Condition Table for Nested Groups (Some Output Scenarios):
Condition c1Condition c2ag1 (Any Group)Condition c3Condition c4nalg2 (Nested All Group)Final Result
TrueTrueTrueTrueTrueTrueTrue
TrueTrueTrueTrueFalseFalseFalse
TrueTrueTrueFalseTrueFalseFalse
TrueTrueTrueFalseFalseFalseFalse
TrueFalseTrueTrueTrueTrueTrue
TrueFalseTrueTrueFalseFalseFalse
TrueFalseTrueFalseTrueFalseFalse
TrueFalseTrueFalseFalseFalseFalse
FalseTrueTrueTrueTrueTrueTrue
FalseTrueTrueTrueFalseFalseFalse
FalseTrueTrueFalseTrueFalseFalse
FalseTrueTrueFalseFalseFalseFalse
FalseFalseFalseTrueTrueTrueTrue
FalseFalseFalseTrueFalseFalseFalse
FalseFalseFalseFalseTrueFalseFalse
FalseFalseFalseFalseFalseFalseFalse

Nested Condition Groups

Quick Recap:

  • Any: The condition group evaluates to true if any of its conditions are true.
  • All: The condition group evaluates to true only if all conditions are true.
  • 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.