And
[[and]] evaluates a list of conditional blocks referenced in condition_ids.
Each entry must be the id of an existing conditional block.
For the Logical AND block to validate, all conditional blocks listed in condition_ids must validate on the same candle.
If all conditions validate, the Logical AND block itself validates, and the strategy execution proceeds to the block specified in next_block_id.
If any of the referenced conditions do not validate, the Logical AND block also does not validate, and this execution path is halted for the current candle.
Block declaration
A strategy can contain multiple [[and]] blocks.
Example
[[and]]
id = "entry_filters"
condition_ids = ["ma_filter", "rsi_filter"]
next_block_id = "entry"Logical Nesting and Transitions
Blocks referenced in the condition_ids key are logical children of the [[and]] block. They are evaluated in the declared order. As soon as one child does not validate, the [[and]] block stops and does not validate on that candle.
When a conditional block is used as a child of [[and]], it must not define next_block_id. This applies to all logical children, including [[wait]], [[or]], and another [[and]] when they are nested inside [[and]].
If the [[and]] block itself is used as a child of another logical block, [[and]] or [[or]], its own next_block_id must also be omitted. If it is used as a direct child of a [[route]] block, it must define next_block_id instead, because [[route]] uses the selected child’s destination.
Block parameters
| Parameter | Description |
|---|---|
idText Required | Unique identifier of the block. |
condition_idsArray Required | List of conditional block IDs to evaluate. Use condition_ids to declare the block’s logical children. |
next_block_idText Conditional | Identifier of the next block to execute once all child conditions are validated on the same candle and the [[and]] block is validated. Must be omitted when this block is itself used as a child of an [[and]] or [[or]] block. Must be defined when this block is used as a direct child of a [[route]] block, because [[route]] follows the selected child’s next_block_id. |
This block does not produce any output variable; it only controls the execution flow.