Title here
Summary here
Use [[cancel]] to cancel all pending orders associated with a given order_id. It targets orders emitted by [[entry]], [[order]], and [[exit]] as long as they have not yet been executed.
If the cancellation removes an entry before execution and there is no open position for that entry, the exit orders tied to that entry are also cancelled.
It is particularly useful for invalidating price orders if market conditions change before they are hit.
A strategy can contain multiple [[cancel]] blocks.
This example cancels the pending order identified by long_limit.
[[cancel]]
id = "cancel_limit_order"
order_id = "long_limit"
next_block_id = "restart_logic"This example cancels pending orders linked to tp_order and immediately continues to restart_logic.
[[cancel]]
id = "clean_up"
order_id = "tp_order"
wait_candles = 0
next_block_id = "restart_logic"| Parameter | Description |
|---|---|
idText Required | Unique identifier for the block. |
order_idText Required | Target identifier for the cancellation. The block cancels all pending orders that share this order_id, including those emitted by [[entry]], [[order]], and [[exit]]. If that order_id targets a deferred [[exit]] already armed with from_entry but not yet materialized, that deferred intent is also cancelled. |
next_block_idText Required | Identifier of the block to execute next. |
wait_candlesInteger Optional | Number of candles to wait before executing the next block. Use 0 to disable the delay.Default value: 0 |