Cross

[[cross]] is a conditional block that compares two numeric expressions, reference and comparison, evaluated on every candle. Both fields can contain a series, a calculation, or simply a fixed numeric value.

Until a cross occurs, the block stays pending and evaluation continues on the next candle. The block is validated on the first candle where reference moves strictly to the other side of comparison, in either direction.

Block declaration

A strategy can contain multiple [[cross]] blocks.

Example

[[cross]]
id            = "ma_cross"
reference     = "fast_ma"
comparison    = "slow_ma"
next_block_id = "next_block"

Block parameters

ParameterDescription
id
 Text
 Required
Unique identifier of the block.
reference
 Expression
 Required
Numeric expression that must move to the other side of comparison for the block to be validated. It can be a series, a calculation, or a fixed numeric value.
comparison
 Expression
 Required
Numeric expression used as the comparison point for reference. It can be a series, a calculation, or a fixed numeric value.
next_block_id
 Text
 Conditional
Identifier of the next block to execute once a bullish or bearish cross is detected and the block is validated.
Must be omitted when the block is used as a child of an [[and]] or [[or]] block. Must be defined when the 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; it simply controls the execution flow when a crossing happens.