Change an open OKX order from a TradingView alert

Autoview · Guide · Updated October 7, 2026

You have a limit order resting on OKX and your alert wants a new price or a new size. Autoview cannot edit that order in place. The way to change it is to cancel it, then place a new one.

This works the same whatever sends the alert. TradingView is a common source, but a script or any other webhook sender uses the same commands.

Why there is no modify command

OKX's API does have a way to change an order. Its docs list an amend order call that edits "an incomplete order" (OKX API docs, checked October 7, 2026).

Autoview's OKX connector does not call it. We read the connector code and found no amend or modify call in it. The cancel calls are there, so cancel and place again is the route that works.

Step 1: cancel the open order

Send c=order with the symbol:

  • Webhook: s=BTC-USDT c=order
  • Extension: e=okx s=BTC-USDT c=order

On OKX, this cancels your open orders on that symbol. It covers regular orders and also pending algo orders, which Autoview looks up as conditional and OCO orders plus trigger orders. If nothing is open, the log says "No open orders."

If you only want one side gone, add b=. s=BTC-USDT b=buy c=order cancels your open buy orders and leaves the sells alone.

Be careful with the other two values. c=position closes your positions, and c=all cancels orders and closes positions together. Neither is what you want when you only mean to move an order.

Step 2: place the new order

Now send the order you actually want, with the new price or size. A limit buy 5% under the market looks like this:

  • Webhook: s=BTC-USDT b=buy p=-5% q=1
  • Extension: e=okx s=BTC-USDT b=buy p=-5% q=1

Use OKX's own instrument code in s=: BTC-USDT for spot, BTC-USDT-SWAP for a perpetual. The OKX setup guide covers symbols and sizes.

Test it before it runs on its own

Put d=1 on the cancel command first. Autoview then lists each order it would cancel in your log and sends nothing to OKX. Check that the list matches what you expect, then remove d=1.

One thing this guide does not settle: whether two command lines in a single alert always run in the order you wrote them. Until you have seen that in your own log, send the cancel and the new order as separate alerts, and check the cancel landed before the new order fires.

What to watch for

  • The cancel is broad. Without b=, every open order on that symbol goes, including conditional and trigger orders you set up by hand. Add b= if you keep manual orders on that symbol.
  • There is a gap. Between the cancel and the new order you have no order resting. A fast market can move through that gap.
  • Read the log. Each cancel shows up as its own line with the OKX order ID. Reading your log shows where to find it.

Open the command reference