Wait
On this page
[[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.
Use this block 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. When it is used as a direct child of a [[route]] block, it still behaves as a time-based condition, but it must define its own next_block_id so [[route]] knows which branch to follow once the wait is complete.
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
| Parameter | Description |
|---|---|
idText Required | Unique identifier of the block. |
wait_candlesInteger | 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_idText Conditional | Identifier of the next block to execute once the wait is complete 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. |
The [[wait]] block does not produce any output variable. Its role is only to control when the strategy resumes execution.