How to Set Up an OKX Signal Trading Bot with TradingView

·

With the launch of the Signal Bot, TradingView users and signal providers can now publish and configure Signal Bots using their TradingView signals. Follow this step-by-step guide to start trading with signals on OKX.

Step 1: Access the Signal Bot

  1. Log in to your OKX account.
  2. Navigate to TradeTrading BotMarketplace.
  3. Select the Signal Bot sub-tab and click Create.

Step 2: Create Your Signal

  1. Click Add Custom Signal to create a customized signal.
  2. Name your signal and add an optional description (up to 500 characters).
  3. Click Create Signal to proceed.

Quick Overview: Pine Script™ "Strategy" vs. "Indicator"

Step 3: Configure TradingView Alerts

Method A: For Strategy Script Users (strategy.*())

  1. Configure Script: Save and add your strategy script to the chart.
  2. Set Alert:

    • Under Alert Condition, select "Order Execution Only".
    • Paste the OKX AlertMsg template into the Message field.
    • Add the OKX-generated Webhook URL under Notifications.
  3. Test: Ensure alerts trigger correctly.

Method B: For Indicator/Custom Script Users

  1. Configure Script: Save and add your indicator script to the chart.
  2. Set Alert:

    • Define a custom condition (e.g., MACD Golden Cross).
    • Use one of OKX’s four predefined messages (ENTER_LONG, EXIT_LONG, ENTER_SHORT, EXIT_SHORT).
    • Add the Webhook URL.
  3. Test: Verify alerts match your trading logic.

👉 Optimize your TradingView alerts for OKX

Step 4: Create Your Signal Bot

  1. Click Create Bot after setting up your signal.
  2. Configure basics:

    • Trading Pairs: Select relevant perpetual swaps.
    • Leverage: Set your risk tolerance (e.g., 10x).
    • Investment: Allocate funds (USDT or % of balance).
  3. Advanced settings (optional):

    • Order Type: Market or Limit.
    • Take Profit/Stop Loss: Define exit strategies.
  4. Confirm and activate the bot.

Step 5: Monitor and Manage Your Bot


FAQ Section

Q1: Can I use free TradingView accounts for OKX Signal Bots?

A: No, a paid TradingView plan is required to access Webhook alerts.

Q2: How do I align TradingView’s "contract size" with OKX?

A: Adjust investmentType to "base" and set amount to {{strategy.order.contracts}} in your AlertMsg.

Q3: What if my third-party program uses fixed IPs?

A: Contact OKX support to whitelist your IP for external signal integration.

Q4: How do I troubleshoot failed signals?

A: Check the alert logs in TradingView and ensure your Webhook URL matches OKX’s provided link.

👉 Explore advanced Signal Bot strategies


Appendix: Sample Scripts & Templates