Wait

[[wait]] introduces an explicit pause in strategy execution. When the engine reaches this block, it suspends evaluation of the graph for the number of candles specified by wait_candles, then resumes on the block referenced by next_block_id.

This behaviour is useful when a strategy must let a fixed number of candles pass before continuing a sequence. During that period, no other block is evaluated.

With wait_candles = 3, the strategy therefore resumes on the next block on the third candle after the trigger candle.

The [[wait]] block can also be used as a child of an [[and]] or [[or]] block. In that context, it behaves like a time-based condition: it becomes true only when the waiting period is complete. The transition is then controlled by the parent logical block rather than by next_block_id.

Block declaration

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

Examples

Default delay

This example waits for one candle, because wait_candles defaults to 1, then resumes execution on continue.

[[wait]]
id            = "wait"
next_block_id = "continue"

Custom delay

This example waits for two candles before resuming execution on continue.

[[wait]]
id            = "wait2"
wait_candles  = 2
next_block_id = "continue"

Block parameters

ParameterDescription
id
 Text
 Required
Unique identifier of the block.
wait_candles
 Integer
Number of candles to wait before moving to the next block. The value must be greater than or equal to 1.
Default value: 1
next_block_id
 Text
 Conditional
Block executed after the delay when [[wait]] is used on its own. This field must be omitted when the block is used as a child of an [[and]] or [[or]] block.

The [[wait]] block does not produce any output variable. Its role is only to control when the strategy resumes execution.