Main clusters and core pages.
AlgoWay lets you connect TradingView alerts to OKX through secure webhook automation. You create an OKX API key, enable Read and Trade permissions, bind the API key to the AlgoWay IP address, create a passphrase, add the credentials to AlgoWay, and then send valid TradingView JSON to your AlgoWay webhook URL.
This guide is written for traders searching for how to connect TradingView to OKX, TradingView to OKX webhook, OKX automated trading, OKX trading bot webhook, OKX API trading, OKX Futures automation, TradingView crypto bot, and automated trading webhook for OKX.
The execution route is:
TradingView alert → AlgoWay webhook → OKX API → OKX Futures / Perpetual order
TradingView creates the signal. AlgoWay receives and validates the webhook JSON. OKX receives the final trading request through the API Key, Secret Key and Passphrase configured in AlgoWay.
Last updated: 2026-05-12 • Author: AlgoWay
To automate OKX from TradingView through AlgoWay, you need:
After setup, a TradingView strategy alert can be routed by AlgoWay to OKX as an automated futures or perpetual order.
TradingView is widely used for charts, Pine Script strategies, indicators and alert logic. OKX provides API access for crypto trading, including derivatives and perpetual markets. AlgoWay connects these systems with a webhook route and exchange API execution layer.
This is useful when you want to:
AlgoWay does not create a profitable strategy. It automates the route after your TradingView strategy, indicator or manual alert sends the command.
Prepare the following:
Open OKX API settings and create a dedicated API key for AlgoWay.
ALGOWAY-OKX.103.241.67.174
If your AlgoWay dashboard shows a different IP, use the IP shown in your dashboard.
| Permission | Use it? | Purpose |
|---|---|---|
| Read | Yes | Needed for account, balance, order and position checks. |
| Trade | Yes | Needed to place and manage OKX trading orders. |
| Withdraw | No | Not required for AlgoWay webhook trading automation. |
After the OKX API key is ready, create the OKX route in AlgoWay.
| AlgoWay field | Recommended value | Purpose |
|---|---|---|
| Source | TradingView | The signal source. |
| Platform | OKX | The exchange destination. |
| Quantity Multiplier | Absolute → 1 or your route setting | Controls how incoming strategy quantity is interpreted. |
| Market Type | Futures / Perpetual | Used for OKX perpetual swap automation. |
| Margin Mode | Cross or Isolated | Defines margin behavior for the order route. |
| Trade Type | Hedge / Reverse / selected mode | Defines how AlgoWay handles existing exposure and opposite signals. |
| API Key | OKX API Key | Used for API authentication. |
| Secret Key | OKX Secret Key | Used for request signing. |
| Passphrase | Your OKX API passphrase | Required by OKX API authentication. |
After saving the OKX webhook, open the webhook list in AlgoWay and copy the unique webhook URL.
Webhook URL format:
https://algoway.co/your-webhook-uuid
TradingView must send valid JSON. AlgoWay expects structured fields, not plain text.
Recommended TradingView strategy alert JSON:
{
"platform_name": "okx",
"ticker": "{{ticker}}",
"order_contracts": "{{strategy.order.contracts}}",
"order_action": "{{strategy.market_position}}",
"price": "{{close}}"
}
TradingView replaces these placeholders when the alert fires:
{{ticker}} — chart ticker;{{strategy.order.contracts}} — strategy order size;{{strategy.market_position}} — strategy position state;{{close}} — close price at alert time.
okx. If it does not match the route, the alert may not be routed correctly.
For a controlled test, use a fixed OKX symbol and small valid quantity:
{
"platform_name": "okx",
"ticker": "BTCUSDT.P",
"order_contracts": 0.01,
"order_action": "buy"
}
Use the exact symbol format accepted by your OKX route. If the order is rejected, check symbol, quantity, market type, margin mode, position mode and account permissions.
After the OKX JSON and AlgoWay webhook URL are ready, create or edit the TradingView alert.
BTCUSDT.P.
For many strategies, Once per bar close is safer than intra-bar alert execution unless your system is intentionally designed for intrabar signals.
AlgoWay's OKX route can use absolute SL/TP prices and distance-style fields. Test every risk field on small size before using live orders.
{
"platform_name": "okx",
"ticker": "ETHUSDT.P",
"order_action": "buy",
"order_contracts": 1,
"sl_price": 1800,
"tp_price": 1850
}
{
"platform_name": "okx",
"ticker": "BTCUSDT.P",
"order_action": "sell",
"order_contracts": 0.5,
"stop_loss": 50,
"take_profit": 100
}
{
"platform_name": "okx",
"ticker": "ARBUSDT.P",
"order_action": "buy",
"order_contracts": 10,
"trailing_pips": 50
}
When trailing stop is used, the route can still allow Take Profit depending on current OKX handler behavior. Stop Loss may be omitted because trailing stop handles dynamic exit protection.
Use "order_action": "flat" when the signal should close an existing position instead of opening a new one.
{
"platform_name": "okx",
"ticker": "BTCUSDT.P",
"order_action": "flat",
"order_contracts": 1
}
In Hedge mode, long and short legs can be handled according to the route and size you send. If you need side-specific closing, check the current AlgoWay JSON schema and route behavior before using live size.
Full mode guide: How AlgoWay handles opposite trading signals.
After the TradingView alert is created, test the route with small size.
If AlgoWay receives the webhook but OKX does not open a trade, check API permissions, passphrase, IP allowlist, symbol, margin mode, quantity, market session, account mode and exchange response.
OKX API authentication requires the passphrase created with the API key. It is not your OKX account password.
OKX shows the Secret Key only once. If it is lost, create a new API key and update AlgoWay.
If the API key is bound to the wrong IP, OKX can reject requests from AlgoWay. Add the AlgoWay IP address shown in your dashboard.
Enable Read and Trade permissions for this automation route. Withdrawal permission is not required.
Spot, margin, futures and perpetual routes are not the same. Match the AlgoWay market type with the OKX market you want to automate.
Cross and Isolated have different margin behavior. If the account state or symbol configuration does not match the requested route, OKX can reject the order.
TradingView symbols and OKX instrument identifiers may differ. Check the exact symbol format used by AlgoWay for your OKX route.
Order size must satisfy OKX minimum quantity, lot size and contract rules. Test with minimal valid size first.
TradingView must send valid JSON. Broken commas, missing quotes or plain text can stop automation before OKX receives anything. See: How to fix AlgoWay webhook Error 415.
JSON in the message field is not enough. Enable Webhook URL in the TradingView Notifications tab and paste the AlgoWay URL.
You can build your own TradingView-to-OKX bot. That requires a public webhook server, JSON parser, OKX API signing, passphrase handling, symbol mapping, futures order routing, SL/TP logic, trailing logic, logs and ongoing monitoring.
AlgoWay gives you a ready route:
This makes AlgoWay a no-code TradingView to OKX webhook connector for traders who want crypto automation without maintaining their own OKX API server.
To automate OKX from TradingView, create an OKX API key with Read and Trade permissions, bind the AlgoWay IP address, save the API Key, Secret Key and Passphrase, create an OKX webhook in AlgoWay, copy the webhook URL, and send valid TradingView JSON.
AlgoWay turns TradingView alerts into OKX webhook automation without forcing you to build and maintain your own crypto trading bot infrastructure.