Tutorial

TradingView Webhook to Bybit: Complete 2026 Setup Guide

← Back to Blog

TradingView has the best charting and strategy tools in the crypto world. Bybit is one of the largest crypto exchanges with deep liquidity and competitive fees. Connecting them so that a TradingView alert automatically places a trade on Bybit is the holy grail of automated crypto trading.

This guide covers every step, from creating your Bybit API keys to configuring alert messages to troubleshooting failed orders. Whether you are automating a Pine Script strategy or just want to get alerted when a condition hits and have the trade execute automatically, this is the definitive walkthrough for 2026.

Prerequisites

Before you start, make sure you have:

  • TradingView Pro, Pro+, or Premium. Webhooks are not available on the free plan. This is a TradingView limitation, not something any middleware can work around. You need at least Pro ($14.95/month) to use webhook URLs in alerts.
  • A Bybit account with funds deposited (USDT recommended for perpetual futures).
  • A middleware server that receives the webhook and forwards it to Bybit's API. This is the piece most tutorials skip over. TradingView cannot talk to Bybit directly.

Understanding the Webhook Flow

Here is what happens when your TradingView strategy or indicator triggers an alert:

TradingView Alert
--- webhook POST --->
Middleware Server
--- Bybit API call --->
Bybit Exchange
--- order executed --->
Trade Placed

Why do you need middleware? TradingView's webhook feature sends an HTTP POST request to a URL you specify. Bybit's API requires authenticated requests with API key signatures, specific headers, and proper order formatting. TradingView cannot do any of that. It just sends a raw text payload to a URL.

The middleware server sits in between. It receives TradingView's simple webhook, parses the data, authenticates with Bybit's API using your keys, formats the order correctly, and places it. Think of it as a translator between two systems that speak different languages.

CryptoScope as Middleware

CryptoScope AI acts as this middleware layer. When you connect your Bybit API keys in the app, you get a unique webhook URL. Point TradingView's alerts at that URL, and the app handles authentication, order formatting, and execution. No server setup required on your end.

Step 1: Create Bybit API Keys

This is the most critical step and the one where security mistakes are most costly. Your API keys give programmatic access to your exchange account.

  1. Log into Bybit and navigate to Account > API Management (or go directly to bybit.com/user/api-management).
  2. Click "Create New Key" and select "System-generated API Keys".
  3. Give it a descriptive name like "TradingView Webhook" so you remember what it is for.
  4. Set permissions:
    • Read -- Required (allows checking balances and positions)
    • Trade -- Required (allows placing and canceling orders)
    • Withdraw -- DO NOT ENABLE. Your webhook middleware never needs to withdraw funds. Leaving this off protects you if your keys are ever compromised.
  5. IP whitelist (recommended): If your middleware has a static IP, restrict the API key to only accept requests from that IP. This is the strongest security measure available. If you do not know your middleware's IP, you can skip this, but understand the risk.
  6. Click "Submit" and complete 2FA verification.
  7. Copy both the API Key and API Secret immediately. Bybit will only show the secret once. Store them securely.
Security Warning

Never share your API secret. Never paste it into a website you do not trust. Never commit it to a public GitHub repository. If you suspect your keys are compromised, delete them from Bybit immediately and create new ones.

Step 2: Connect API Keys to Your Middleware

How you do this depends on your middleware. If you are using CryptoScope AI:

  1. Log into the CryptoScope app at signalbot.cryptoscopeai.com:3000
  2. Go to Settings
  3. Find the Exchange API section
  4. Select Bybit as your exchange
  5. Paste your API Key and API Secret
  6. Click Save -- the app will verify the keys work by making a test balance request

If you are building your own middleware (a Node.js or Python server), you would store these keys in environment variables and use Bybit's official SDK to authenticate API calls.

Step 3: Get Your Webhook URL

Your middleware provides a unique URL that TradingView will send alerts to. In CryptoScope, this is displayed in Settings > TradingView Webhook. The URL looks something like:

https://signalbot.cryptoscopeai.com:3000/api/webhook/tv/YOUR_UNIQUE_TOKEN

The token at the end identifies your account. When the server receives a POST request at this URL, it knows which user's API keys to use for the Bybit order.

Step 4: Format Your Alert Message

This is where most people get stuck. TradingView sends whatever text you put in the "Message" field of your alert. Your middleware needs to parse this text and extract trading instructions. The cleanest approach is JSON:

{
  "symbol": "BTCUSDT",
  "side": "buy",
  "quantity": "0.001",
  "price": "{{close}}",
  "takeProfit": "{{plot("TP Level")}}",
  "stopLoss": "{{plot("SL Level")}}"
}

Let us break down each field:

FieldDescriptionExample
symbolThe Bybit trading pair, matching their exact symbol formatBTCUSDT, ETHUSDT, SOLUSDT
side"buy" to go long, "sell" to go short or close a longbuy, sell
quantityPosition size in base currency (e.g., BTC amount for BTCUSDT)0.001, 0.5, 100
priceEntry price. Use {{close}} for the candle's closing price{{close}}, 65000
takeProfitTake profit price. Can use Pine Script plot values{{plot("TP Level")}}
stopLossStop loss price. Can use Pine Script plot values{{plot("SL Level")}}
Tip: TradingView Placeholders

The double-brace syntax like {{close}} is a TradingView placeholder. When the alert fires, TradingView replaces it with the actual value. {{ticker}} gives you the symbol, {{time}} gives you the timestamp, and {{plot("Name")}} pulls a named value from your Pine Script.

Step 5: Create the TradingView Alert

  1. Open your chart on TradingView with your strategy or indicator applied.
  2. Click the "Alert" button (clock icon with a +) or press Alt+A.
  3. Set your Condition:
    • For strategies: select your strategy name, then choose the condition (e.g., "Order fills only" to trigger when a strategy order executes).
    • For indicators: select the indicator and the specific condition (crossing above/below a level, etc.).
  4. Under "Notifications", check "Webhook URL" and paste your middleware URL.
  5. In the "Message" field, paste your JSON payload from Step 4.
  6. Set "Alert name" to something descriptive (e.g., "BTC Long Entry").
  7. Set expiration. For ongoing strategies, choose "Open-ended alert" so it does not expire.
  8. Click "Create".

Step 6: Test Before Going Live

Do not skip this. The first time you set up a webhook, something will almost certainly be wrong. Here is a safe testing process:

  1. Use paper trading first. If your middleware supports it (CryptoScope does), enable paper trading mode before testing webhooks. This way, even if your alert fires unexpectedly, no real money moves.
  2. Trigger a test alert manually. On TradingView, right-click your alert and choose "Trigger alert." This sends the webhook immediately without waiting for the condition.
  3. Check your middleware logs. Did the server receive the webhook? Was the JSON parsed correctly? Was the Bybit API call successful?
  4. Verify on Bybit. Check your order history. Did the order appear? Was it the correct symbol, side, and quantity?
  5. If everything looks good, switch to live mode and let it run.

Troubleshooting Common Issues

Alert Not Firing

  • Condition never met: Double-check your alert condition. Add the indicator to the chart and visually verify that the condition would trigger on recent data.
  • Alert expired: TradingView alerts expire by default. Check that your alert has not already expired.
  • Wrong timeframe: Alerts evaluate on the timeframe they were created on. If you created the alert on a 1-hour chart, it checks every hour, not every minute.

Webhook Not Received

  • Wrong URL: Copy-paste the exact URL. A single extra character or missing slash will cause it to fail silently.
  • Server down: If your middleware server is offline, the webhook has nowhere to go. TradingView does not retry failed webhooks.
  • HTTPS required: TradingView only sends webhooks to HTTPS URLs. If your server uses plain HTTP, it will not work.

Order Rejected by Bybit

  • Insufficient balance: Check that you have enough USDT (or the relevant margin currency) in your derivatives account, not just your spot wallet.
  • Wrong symbol format: Bybit uses specific symbol names. "BTC/USDT" will not work; it must be "BTCUSDT" (no slash, no spaces).
  • API permissions: If your key does not have "Trade" permission, read requests will succeed but orders will be rejected.
  • Quantity too small: Each Bybit pair has a minimum order size. Check the pair's trading rules.
  • IP whitelist blocking: If you set an IP whitelist on your API key, make sure your middleware server's IP is included.

Advanced: Multi-Symbol Strategies

Once you have a single webhook working, you can scale to multiple symbols. There are two approaches:

One Alert Per Symbol

Create separate alerts for BTCUSDT, ETHUSDT, SOLUSDT, etc. Each alert has the symbol hardcoded in its JSON message. This is the simplest approach and easiest to debug.

Dynamic Symbol From Pine Script

Use TradingView's {{ticker}} placeholder in your alert message:

{
  "symbol": "{{ticker}}",
  "side": "buy",
  "quantity": "{{strategy.order.contracts}}"
}

This way, one alert template works across any chart you apply it to. Just be careful that {{ticker}} returns the format Bybit expects. On some TradingView data feeds, the ticker might be "BINANCE:BTCUSDT" instead of just "BTCUSDT". Your middleware should strip the exchange prefix if present.

Advanced: Partial Take Profit Levels

Many strategies use multiple take profit levels: close 25% at TP1, 25% at TP2, and 50% at TP3. You can handle this in your webhook message:

{
  "symbol": "BTCUSDT",
  "side": "buy",
  "quantity": "0.004",
  "stopLoss": "62000",
  "takeProfits": [
    {"price": "68000", "percentage": 25},
    {"price": "72000", "percentage": 25},
    {"price": "78000", "percentage": 50}
  ]
}

Your middleware needs to support this format -- not all do. CryptoScope handles multi-level TP by placing separate conditional orders on Bybit for each level, automatically calculating the correct quantity for each based on the percentage.

Position Sizing Best Practices

Hardcoding a fixed quantity (like "0.001 BTC") in your alert works, but it does not adapt to your account balance. Better approaches:

  • Percentage-based sizing: Some middleware tools let you specify "risk 2% of account" instead of a fixed quantity. The server calculates the position size based on your current balance and the distance to your stop loss.
  • Fixed dollar amount: Instead of quantity, specify a dollar amount (e.g., "$500") and let the middleware calculate how many coins that buys at the current price.
  • Strategy-calculated: If your Pine Script strategy already calculates the optimal position size, use {{strategy.order.contracts}} to pass it through.
Warning: Start Small

When you first go live, use the smallest position size your exchange allows. Even if your paper testing was perfect, live execution has nuances: slippage, partial fills, network latency. Run the smallest possible trades for a week before scaling up.

Start Trading Smarter

CryptoScope AI handles the middleware for you. Connect Bybit API keys, get your webhook URL, and start automating TradingView alerts in minutes.

Launch App Start Free Trial
← Back to Blog