Skip to content
Sign In

Learning / Syntax / wait

wait - Pause Execution

Pause webhook execution for a specified duration before continuing to the next command.

What is wait?

wait pauses your webhook execution for a fixed amount of time. When the wait completes, execution continues with the next command in your script.

Common Use Cases:

  • Timed Order Management

    Place an order, wait for fill window, then cancel if not filled

  • Staggered Entries

    Enter position in stages with delays between each entry

  • Delayed Exits

    Hold position for minimum time before allowing exits

Syntax

Smart Syntax
wait <duration>

Parameters

durationRequired

Type: number or string | Default: 1s | Maximum: 60s

How long to wait. Can be specified with time units:

FormatExampleDuration
number1010 seconds (default unit)
ms500ms500 milliseconds
s, sec, seconds30s30 seconds
m, min, minutes1m60 seconds (1 minute)
h, hr, hours1h1 hour (use with caution - blocks worker)

Real-World Examples

1. Timed Order - Cancel if Not Filled

Place a limit order, give it 30 seconds to fill, then cancel if still pending.

Smart Syntax
BTCUSDT on My_API_Key
// Place limit buy order
limit long 0.01 off 0.5% #entry
// Wait 30 seconds for fill
wait 30s
// Cancel if not filled
rem #entry

If order fills within 30s, there's nothing to cancel. If still pending, it's cancelled.

2. Staggered Entry (DCA Strategy)

Enter position in 3 stages with 20-second delays between each.

Smart Syntax
ETHUSDT on My_API_Key
// First entry - 33%
market long 33%
wait 20s
// Second entry - 33%
market long 33%
wait 20s
// Final entry - remaining balance
market long 99%

Dollar-cost averaging over 40 seconds. Smooths out entry price during volatile moves.

3. Delayed Stop Loss Placement

Enter position, wait for initial volatility to settle, then place stop loss.

Smart Syntax
BTCUSDT on My_API_Key
// Enter immediately
market long 0.01
// Wait for initial volatility
wait 10s
// Now place protection
sl-or-tp short 100%p sl off 2% tp off 5%

Avoids stop loss being immediately triggered by entry-related volatility.

4. Multiple Waits for Longer Delays

Need to wait 2 minutes? Chain two 60-second waits.

Smart Syntax
BTCUSDT on My_API_Key
market long 0.01
// Wait 2 minutes total
wait 60s
wait 60s
// Exit after 2 minutes
market short 100%p

For delays longer than 1 minute, chain multiple wait 60s commands.

Best Practices

  • Keep waits under 60 seconds - Maximum enforced limit

  • Use with rem for timed orders - Common pattern: place → wait → rem

  • Consider market volatility - In fast markets, even 10s can be significant

  • Use TradingView for long delays - Better than chaining many wait commands

Related Commands

rem

- Often used after wait to cancel unfilled orders

limit

- Place timed entry orders

market

- Staggered entries with waits between