How to Configure an OKX Trading Bot with TradingView Signals

·

With the launch of signal bots, TradingView users and signal providers can now publish and configure a signal bot using their TradingView signals. Follow the step-by-step guide below to start trading with signals on OKX.

Step 1: Access the Signal Bot

Log in to your OKX account, navigate to Trading -> Trading Bots -> Marketplace. Then, select the Signal Bot subsection and click "Create."

Step 2: Create Your Signal

  1. Click "Add Custom Signal" to begin.
  2. Name your signal and optionally add a description (up to 500 characters).
  3. Select "Create Signal" to proceed.

Key Configurations:

Pine Script™ Overview: Strategy vs. Indicator

Step 3: Configure TradingView Alerts

3.1 For Strategy Scripts:

  1. Save and add your script to the chart.
  2. Set order parameters (e.g., size in USDT, contracts, or equity percentage).
  3. Use the OKX-provided alert message template in TradingView’s "Message" field.

    Example template for USDT-based orders:

    {
      "action": "{{strategy.order.action}}",
      "instrument": "{{ticker}}",
      "investmentType": "base",
      "amount": "{{strategy.order.contracts}}"
    }

3.2 For Indicators/Study Scripts:

  1. Add the script to your chart.
  2. Configure alerts with OKX’s message template (e.g., ENTER_LONG, EXIT_SHORT).

3.3 For Chart Analysis:

  1. Set conditions (e.g., RSI crossing 30).
  2. Paste the OKX alert message template into TradingView.

3.4 For Third-Party Programs:

Use Python or similar tools to send webhook requests. Example:

import requests
signal_data = {
  "action": "ENTER_LONG",
  "instrument": "BTC-USDT-SWAP",
  "signalToken": "YOUR_TOKEN",
  "investmentType": "percentage_balance",
  "amount": "100"
}
response = requests.post('https://www.okx.com/join/BLOCKSTARalgo/signal/trigger', json=signal_data)

Step 4: Set Up Your Signal Bot

  1. Select "Create Bot" and define:

    • Trading Pairs
    • Leverage Ratio
    • Margin Allocation
  2. Advanced settings:

    • Order type (Limit/Market)
    • Take Profit/Stop Loss levels
  3. Confirm to launch the bot.

Step 5: Monitor and Manage Your Bot

👉 Explore Advanced Signal Bot Strategies

Appendix

Example Scripts:

FAQ

Q: How do I align TradingView order settings with OKX?

A: Ensure investmentType and amount match your strategy (e.g., base for USDT, percentage_balance for equity %).

Q: Can I modify alert templates?

A: Yes, but adhere to OKX’s specifications to avoid errors.

Q: What if my third-party IP isn’t whitelisted?

A: Contact OKX support to validate external signals.

👉 Troubleshooting Signal Bot Issues