KuCoin Setup Guide
Connect TradingView to KuCoin (Spot, Margin, and Futures) using TradeAdapter’s direct API integration for strategies and indicators.
Video walkthrough #
KuCoin + TradingView setup
1 — Create KuCoin API keys #
-
Log in to KuCoin
Go to kucoin.com and sign in to your account.
-
Open API Management
Navigate to API Management (or Profile → API Management) and click Create API.
-
Fill in API details
Give the API a name (e.g.
TradeAdapter) and create a Passphrase. You will need the API Key, Secret, and Passphrase together for TradeAdapter. -
Choose trade permissions and markets
Select the Trade permission and choose which markets to allow: Spot, Margin, and/or Futures depending on what you plan to use with TradeAdapter.
-
Restrict access to TradeAdapter IP
Add the TradeAdapter IP
35.75.198.16to the API whitelist. This limits API calls to TradeAdapter only. -
Save your credentials
After you pass email/2FA verification, copy your API Key, Secret, and Passphrase. Store them in a safe place — the Secret is shown only once.
2 — Select the KuCoin symbol in TradingView #
Open TradingView and search for the symbol using the KUCOIN prefix. Make sure the symbol and market type match what you enabled for the API key.
Search KUCOIN:BTCUSDT, KUCOIN:ETHUSDT, etc.
For KuCoin Futures, select the corresponding futures symbol offered by TradingView under the KuCoin exchange.
Important
The {{ticker}} placeholder in your alert message sends this exact symbol name to KuCoin. If you pick the wrong symbol type (e.g. Spot instead of Futures) or a symbol that is not supported in the chosen market, the order will fail.
3 — Add your indicator or strategy #
Load your Pine Script indicator or strategy onto the chart. This is what generates the trading signals for KuCoin.
Open Pine Editor, paste your strategy code, and click “Add to chart”. Then open the Strategy Tester tab to confirm backtest trades appear.
Add the indicator to the chart. It must use alertcondition() for Buy/Sell (and optionally TP/SL) events. You will create one alert per action.
Not sure which one you have? See Indicator vs Strategy.
4 — Configure order size #
KuCoin enforces symbol-specific rules for quantity and price (min order size, price step, etc.). Make sure your order size meets these requirements for Spot, Margin, or Futures.
How to set order size
Strategy: configure your strategy’s position size so that {{strategy.order.contracts}} always respects the symbol’s minimum and step. For example, if minimum is 0.1 and step is 0.1, avoid sizes like 0.05.
Indicator: you set the size manually in the alert message using order_contracts (see below).
Check symbol precision and minimums:
KuCoin Spot Symbols •
KuCoin Margin Symbols •
KuCoin Futures Symbols
5 — Create the TradingView alert #
Press Alt + A (or click the alarm clock icon) to create a new alert on your strategy or indicator.
Under Condition, select your strategy and set trigger to “Order fills only”. TradingView fills action, size, and price automatically through the {{strategy.*}} placeholders.
Under Condition, choose the specific alertcondition() (e.g. Buy, Sell, TP, SL). You will set order_action and order_contracts manually in the JSON.
Required: Webhook URL + Message
In the Notifications tab, enable Webhook URL and paste your personal webhook from your TradeAdapter profile. Then paste the JSON message (below) in the Message field.
Alert message formats #
Use one of the following templates depending on whether you send alerts from a strategy or an indicator.
{
"kucoin_api_key": "YOUR_KUCOIN_API_KEY",
"kucoin_secret": "YOUR_KUCOIN_SECRET",
"kucoin_passphrase": "YOUR_KUCOIN_PASSPHRASE",
"real_order": "No",
"order_market": "Spot",
"order_type": "Market",
"futures_leverage": "2",
"isolated_margin": "No",
"exchange": "kucoin",
"ticker": "{{ticker}}",
"time": "{{timenow}}",
"order_contracts": "{{strategy.order.contracts}}",
"order_action": "{{strategy.order.action}}",
"order_price": "{{strategy.order.price}}"
}
Open KuCoin Message Generator (Strategy)
{
"kucoin_api_key": "YOUR_KUCOIN_API_KEY",
"kucoin_secret": "YOUR_KUCOIN_SECRET",
"kucoin_passphrase": "YOUR_KUCOIN_PASSPHRASE",
"real_order": "No",
"order_action": "BUY",
"order_size": "0.01",
"order_market": "Spot",
"order_type": "Market",
"futures_leverage": "2",
"isolated_margin": "No",
"exchange": "kucoin",
"ticker": "{{ticker}}",
"time": "{{timenow}}"
}
Message fields explained #
| Field | Description |
|---|---|
kucoin_api_key |
Your KuCoin API Key from Step 1. |
kucoin_secret |
Your KuCoin API Secret from Step 1. |
kucoin_passphrase |
The API Passphrase you created when generating the key. |
real_order |
"Yes" sends real orders to KuCoin. "No" sends test orders via TradeAdapter only (no live trades). |
order_market |
Choose which market to trade: "Spot", "Margin", or "Futures". Must match both your API permissions and the TradingView symbol. |
order_type |
"Market" or "Limit". For Limit orders, order_price is used as the limit price. |
futures_leverage |
Applicable only when order_market = "Futures". Must be an integer within the max leverage for the symbol (see KuCoin Futures Symbols page). |
isolated_margin |
Only for Margin orders. Use "Yes" for isolated, "No" for cross. For Spot and Futures you can leave it "No". |
exchange |
Must be "kucoin" so TradeAdapter routes the order to KuCoin. |
ticker |
The TradingView symbol (e.g. KUCOIN:BTCUSDT) provided by {{ticker}}. |
time |
Alert time from TradingView ({{timenow}}). |
order_contracts (Strategy) |
Position size from your strategy ({{strategy.order.contracts}}). |
order_action |
"BUY" or "SELL". For strategies this is filled by {{strategy.order.action}}; for indicators you set it manually. |
order_price (Strategy) |
Price from the strategy ({{strategy.order.price}}), used for Limit orders. |
order_size (Indicator) |
Manual quantity for indicator alerts. Must respect symbol minimum and precision for the selected market. |
6 — Execute & monitor #
-
Start with test orders
Set
"real_order": "No"first and let a few alerts fire. Check the MyTrades page to see how TradeAdapter interprets your signals. -
Verify on KuCoin
When you switch to
"real_order": "Yes", monitor the Orders and Trade History on KuCoin for Spot, Margin, or Futures (depending on yourorder_market). -
Scale up gradually
Begin with small sizes and only increase after you’ve confirmed that symbols, order sizes, and leverage behave as expected.
Important notes #
API security — Never share your Secret or Passphrase. Keep withdrawals disabled and restrict your key to the TradeAdapter IP (
35.75.198.16).
Respect symbol filters — Always check Spot, Margin, or Futures symbol specs and test with small orders before scaling.
Recreate alerts after changes — If you change strategy parameters, leverage, or message fields, delete and recreate the alert. Editing an existing alert does not refresh all values reliably.
Symbol & market must match —
order_market, the TradingView symbol, and the KuCoin symbol list (Spot/Margin/Futures) must all align.
Monitor MyTrades — Use TradeAdapter’s MyTrades as the single source of truth for what orders are being sent.
All setup guides