OKX logoOKX + TradingView

How to Connect TradingView to OKX

Turn TradingView alerts into automated OKX orders with a webhook. Works across the OKX Unified Account — spot, margin, futures, and swaps — with no coding required.

No coding requiredFree tier availableSetup in ~10 minutes

The OKX Unified Account lets you trade spot, margin, futures, and perpetual swaps from a single balance. Connecting TradingView to OKX means your strategy can act on any of those markets the instant an alert fires, instead of waiting for you to place the order manually.

OmniTrade24 is the link between your TradingView charts and OKX. Each strategy gets a webhook URL you paste into a TradingView alert; we then execute the matching order on OKX using your API credentials. OKX uses three-factor authentication, so this guide also covers the passphrase you set when creating your V5 API key.

Skip the manual setup — automate this in minutes.

Free tier: 100 executions/month, no card required.

What you can automate on OKX

OKX Unified Account
Spot trading
Margin (cross & isolated)
Futures & Perpetual Swaps
Shared-margin execution
Long & short automation

How to connect TradingView to OKX

Four steps take you from a chart alert to a live OKX order — no code involved.

1

Create your OKX API key

  1. 1.Create a V5 API key. In OKX, go to Account → API and click Create V5 API key.
  2. 2.Set Trade permission and passphrase. Select the Trade permission and set a passphrase. OKX authentication needs API Key + Secret + Passphrase, so keep the passphrase handy.
  3. 3.Whitelist our IP. Add 64.227.147.170 to the key's IP whitelist so it only works from our execution server.
  4. 4.Copy all three values. Copy the API Key, Secret Key, and Passphrase, then paste all three into OmniTrade24 to connect your OKX account.
2

Connect OKX to OmniTrade24

Sign in to OmniTrade24, open Settings → API credentials, and paste your OKX API key, secret key and passphrase. Run the built-in connection test to confirm the credentials work. Everything is encrypted with AES-256 before it is stored — your secret is never kept in plain text.

3

Create a strategy and copy your webhook URL

In the dashboard, create a strategy, pick your OKX market and default order settings, and save it. OmniTrade24 generates a unique webhook URL just for that strategy:

https://omnitrade24.com/webhook/your-strategy-token
4

Paste the webhook into a TradingView alert

Open your strategy or indicator in TradingView, click Alerts → Create Alert, and paste the webhook URL into the Webhook URL field (under Notifications). Set the alert message to JSON that tells OmniTrade24 what to trade:

// Buy spot
{"action":"BUY","symbol":"BTCUSDT","quantity":0.001}
// Sell spot
{"action":"SELL","symbol":"BTCUSDT","quantity":0.001}
// Open long (futures)
{"action":"LONG","symbol":"BTCUSDT","quantity":0.01}
// Open short (futures)
{"action":"SHORT","symbol":"BTCUSDT","quantity":0.01}
// Close long
{"action":"CLOSE_LONG","symbol":"BTCUSDT","quantity":0.01}
// Close short
{"action":"CLOSE_SHORT","symbol":"BTCUSDT","quantity":0.01}

Save the alert. From now on, every time your strategy fires, the alert hits your webhook and OmniTrade24 places the matching order on OKX automatically — typically within 100–500ms depending on your plan.

Supported alert actions

Each TradingView alert message is a small JSON payload with an action, a symbol, and a quantity. Use dynamic TradingView placeholders (like {{ticker}}) to pass the traded symbol automatically.

Buy spot
{"action":"BUY","symbol":"BTCUSDT","quantity":0.001}
Sell spot
{"action":"SELL","symbol":"BTCUSDT","quantity":0.001}
Open long (futures)
{"action":"LONG","symbol":"BTCUSDT","quantity":0.01}
Open short (futures)
{"action":"SHORT","symbol":"BTCUSDT","quantity":0.01}
Close long
{"action":"CLOSE_LONG","symbol":"BTCUSDT","quantity":0.01}
Close short
{"action":"CLOSE_SHORT","symbol":"BTCUSDT","quantity":0.01}

Is automated OKX trading safe?

Automation is only as safe as the way it is set up. OmniTrade24 is built so that a leaked or misused key still cannot cost you your funds:

Assign only the Trade permission — leave Withdraw disabled so funds cannot leave OKX.
Record the passphrase you set; OKX will not display it again and it is required to authenticate.
Whitelist our IP (64.227.147.170) to lock the key to our server.
Credentials are AES-256 encrypted, and orders execute only when a valid TradingView alert is received.

Best strategies to automate on OKX

Traders who want one automated setup spanning spot, margin, and swaps on the OKX Unified Account with shared margin.

Skip the manual setup — automate this in minutes.

Free tier: 100 executions/month, no card required.

Ready to connect TradingView to OKX?

Create a free account, connect OKX, and turn your next TradingView alert into a live trade.

No credit card required • 100 free executions/month

Connect TradingView to OKX — FAQ

Common questions about automating OKX trades with TradingView and OmniTrade24