Bybit Setup Guide
Connect TradingView to Bybit (Spot, Margin, Futures, and CopyTrading) using TradeAdapter’s direct API integration — step by step.
Video walkthrough #
Bybit + TradingView setup
1 — Create Bybit API keys #
Demo or Real?
We recommend starting with the Demo account at testnet.bybit.com to test your setup safely. When ready, switch to the Real account at www.bybit.com.
-
Create or log in to your account
Go to testnet.bybit.com (Demo) or www.bybit.com (Real) and sign in or register.
-
Open API Management
Go to Profile → API Management or navigate directly to API Management. Click “Create New Key”.
-
Choose System-generated API Keys
Select “System-generated API Keys” and give it a descriptive name (e.g.
TradeAdapter). -
Set permissions
Enable Trade permissions for the markets you plan to use (Spot, Derivatives, CopyTrading). Keep Withdrawals disabled — TradeAdapter never needs withdrawal access.
-
Restrict to TradeAdapter IP
Under IP access restrictions, add the TradeAdapter IP:
35.75.198.16 -
Save your credentials
Copy your API Key and Secret. They are shown only once — store them securely. You will paste both values into the alert message.
2 — Select the Bybit symbol in TradingView #
Open TradingView and search for the symbol using the BYBIT prefix. Make sure you select the correct market type:
Search BYBIT:BTCUSDT, BYBIT:ETHUSDT, etc.
Search BYBIT:BTCUSDT.P or look for the Swap suffix.
Important
The {{ticker}} placeholder in your alert message sends this exact symbol name to Bybit. If you pick the wrong symbol type (e.g. Spot instead of Futures), the order will fail or go to the wrong market.
3 — Add your indicator or strategy #
Load your Pine Script indicator or strategy onto the chart. This is what generates the trading signals.
Go to Pine Editor, paste your strategy code, and click “Add to chart”. Check the Strategy Tester tab to confirm backtesting results appear.
Add the indicator to the chart. It must use alertcondition() to fire signals. You’ll create one alert per action (Buy, Sell, TP, SL…).
Not sure which one you have? See Indicator vs Strategy.
4 — Configure order size #
Bybit enforces minimum quantity rules per symbol. Before creating the alert, make sure your order size meets these requirements.
How to set order size
If using a Strategy: go to strategy settings and set Order Size in “Contracts” to a value that fits the symbol’s minimum quantity. For example, BTCUSDT Spot requires a minimum of 0.000001 BTC.
If using an Indicator: you set the size manually via order_contracts in the alert message.
Check the exact filters for your symbol: Bybit Supported Symbols — Spot
5 — Create the TradingView alert #
Press Alt + A (or click the alarm clock icon) to create a new alert.
Under Condition, select your strategy. Set trigger to “Order fills only”. TradingView fills action, size, and price automatically.
Under Condition, select the specific signal (Buy, Sell, TP, SL…). You set order_action and order_contracts manually in each message.
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 #
Paste the appropriate JSON message into the alert’s Message field. Replace only the highlighted values — the {{...}} placeholders are filled automatically by TradingView when the alert fires.
For Strategy #
{
"bybit_api_key": "YOUR_API_KEY",
"bybit_secret": "YOUR_SECRET",
"real_order": "No",
"order_market": "Spot",
"order_type": "Market",
"isolated_margin": "No",
"auto_rounding": "Yes",
"exchange": "{{exchange}}",
"ticker": "{{ticker}}",
"time": "{{timenow}}",
"order_contracts": "{{strategy.order.contracts}}",
"order_action": "{{strategy.order.action}}",
"order_price": "{{strategy.order.price}}",
"market_position": "{{strategy.market_position}}",
"market_position_size": "{{strategy.market_position_size}}",
"prev_market_position": "{{strategy.prev_market_position}}",
"prev_market_position_size": "{{strategy.prev_market_position_size}}"
}
Open Message Generator — Strategy
For Indicator #
{
"bybit_api_key": "YOUR_API_KEY",
"bybit_secret": "YOUR_SECRET",
"real_order": "No",
"order_market": "Spot",
"order_type": "Market",
"order_action": "buy",
"order_contracts": "100",
"isolated_margin": "No",
"auto_rounding": "Yes",
"exchange": "{{exchange}}",
"ticker": "{{ticker}}",
"time": "{{timenow}}"
}
Create one alert per action — duplicate the alert, change order_action to sell, and adjust order_contracts as needed.
Message fields explained #
| Field | Description |
|---|---|
bybit_api_key |
Your Bybit API Key (from Step 1) |
bybit_secret |
Your Bybit Secret (from Step 1) |
real_order |
"Yes" executes on Bybit. "No" creates a test order (uses Demo/Testnet API keys). |
order_market |
"Spot", "Margin", "Futures", or "Copy" |
order_type |
"Market" or "Limit" |
isolated_margin |
Only for Margin orders. "Yes" = isolated, "No" = cross. Keep "No" for Spot/Futures. |
auto_rounding |
Automatically rounds position size and price to fit Bybit filters. Keep "Yes". |
order_action |
Indicator: "buy" or "sell". Strategy: filled by {{strategy.order.action}}. |
order_contracts |
Indicator: quantity as a number. Strategy: filled by {{strategy.order.contracts}}. |
6 — Execute & monitor #
-
Start with Demo
Use API keys from testnet.bybit.com and set
"real_order": "No". Let the first alert fire and check your MyTrades page. -
Verify on Bybit Testnet
Log in to testnet.bybit.com and check your order history to confirm the trade was placed correctly.
-
Go live
Create new API keys on www.bybit.com (real account), update the message with your real API credentials, change
"real_order"to"Yes", delete the old alert, and create a new one.
Symbol specifications #
Bybit enforces minimum quantity and max quantity rules per symbol. Check the full list before setting your order size to avoid rejections.
Min Qty, Step Size, Max Qty.
Min Qty, Max MKT Qty, Max Qty.
Min Qty, Max Qty, Leverage.
Important notes #
API security — Never share your Secret. Keep withdrawals disabled. Only whitelist the TradeAdapter IP (
35.75.198.16).
Demo first — Start with Bybit’s Testnet. Use Demo API keys and
"real_order": "No" to validate your setup before going live.
Recreate alerts after changes — If you modify Pine Script parameters, delete and recreate the alert. Editing an existing alert does not update placeholders.
Symbol must match — The TradingView chart symbol must correspond to a valid symbol on Bybit for the selected market type.
Order size — Check Symbol Specifications to ensure your order meets Bybit’s minimum quantity requirements.
All setup guides