With the launch of signal bots, TradingView users and signal providers can now publish and configure signal bots for their TradingView signals. Follow this step-by-step guide to start trading with signals on OKX.
For a comprehensive guide on alert message specifications, refer to the Alert Message Specifications section.
If you encounter issues, consult the FAQ guide—a valuable resource for troubleshooting product-related challenges.
Step 1: Access the Signal Bot
- Log in to your OKX account.
- Navigate to Trade → Trading Bots → Marketplace.
- Select the Signal Bot subtab and click Create.
Step 2: Create Your Signal
- Click Add Custom Signal to begin.
- Name your signal and add an optional description (max 500 characters).
- Select Create Signal to proceed.
After clicking Create, you’ll see a page prompting you to:
- Add the Webhook URL (auto-generated by OKX).
- Configure AlertMsg Specifications for TradingView notifications.
Two Alert Configuration Methods:
- TradingView (Strategy Scripts): For users leveraging
strategy.*()functions. - Custom (Indicators/Third-Party Tools): For broader use cases, including chart alerts and third-party programs.
Pine Script™ Overview: Strategy vs. Indicator
| Feature | Strategy Scripts | Indicator Scripts |
|-----------------------|------------------------------------------|---------------------------------------|
| Purpose | Backtesting/live trading | Technical analysis |
| Broker Emulator | Yes | No |
| Resource Intensity| Higher | Lower |
👉 Learn more about Pine Script™ best practices
Step 3: Configure TradingView Alerts
3.1 TradingView Strategy Scripts
- Save & Add Script: Configure your strategy in Pine Editor and attach it to the chart.
Set Order Parameters: Align order size (USDT/contracts/% of equity) with OKX requirements.
Example for USDT-based orders:
{ "investmentType": "base", "amount": "{{strategy.order.contracts}}" }
Create Alert:
- Condition:
Order fills only. - Message: Paste OKX’s AlertMsg template.
- Webhook URL: Enter the URL from OKX.
- Condition:
3.2 TradingView Indicators/Studies
- Attach your indicator to the chart.
- Set AlertCondition (e.g., MACD Golden Cross).
- Use OKX’s ENTER_LONG/EXIT_SHORT message templates.
3.3 Chart Analysis Alerts
- Set conditions (e.g., RSI-14 crossing 30).
- Add OKX AlertMsg specifications.
3.4 Third-Party Programs
- Send signals via Python/webhooks (see Appendix B for sample code).
- Contact OKX support to whitelist IPs.
Step 4: Set Up Your Signal Bot
Basic Settings:
- Trading pairs, leverage, margin allocation.
Advanced Options:
- Order type (market/limit).
- Take-profit/stop-loss levels.
- Confirm to launch the bot.
Step 5: Manage Your Bot
- Monitor Performance: Track history, open positions, and orders.
- Adjust Margin: Add/remove funds as needed.
- Manual Orders: Override signals for specific trades.
- Stop Bot: Closes all positions and cancels orders.
Appendix
A. Example: MACD Alert Script
//@version=5
indicator("MACD Sample Script", overlay=true)
goldenCross = ta.crossover(macdLine, signalLine)
alertcondition(goldenCross, "MACD Golden Cross", "")B. Python Webhook Request
signal_data = {
"action": "ENTER_LONG",
"instrument": "BTC-USDT-SWAP",
"signalToken": "YOUR_TOKEN",
"timestamp": datetime.utcnow().isoformat(),
"investmentType": "percentage_balance",
"amount": "100"
}
response = requests.post(LIVE_TRADING_URL, json=signal_data)C. Sample Scripts
FAQ
Q1: How do I troubleshoot signal delays?
A1: Check your webhook URL and TradingView subscription status.
Q2: Can I use custom indicators?
A2: Yes—configure alerts using the Custom method.
Q3: What leverage is recommended for beginners?
A3: Start with 5–10x to manage risk.
👉 Explore advanced signal strategies