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.
Four steps take you from a chart alert to a live OKX order — no code involved.
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.
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-tokenOpen 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:
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.
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.
{"action":"BUY","symbol":"BTCUSDT","quantity":0.001}{"action":"SELL","symbol":"BTCUSDT","quantity":0.001}{"action":"LONG","symbol":"BTCUSDT","quantity":0.01}{"action":"SHORT","symbol":"BTCUSDT","quantity":0.01}{"action":"CLOSE_LONG","symbol":"BTCUSDT","quantity":0.01}{"action":"CLOSE_SHORT","symbol":"BTCUSDT","quantity":0.01}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:
Traders who want one automated setup spanning spot, margin, and swaps on the OKX Unified Account with shared margin.
Common questions about automating OKX trades with TradingView and OmniTrade24