How to Automate TradingView Alerts to Bybit

Bybit’s TTA integration covers both Spot and Futures — buy, sell, modify, close, set take profit and stop loss, place conditional orders, trail your stops, and check your balance, all from a single TradingView alert. No manual execution required once it’s set up.

What you’ll need

  • A TradingView account with alerts enabled on your plan
  • A Bybit account with API access
  • A TTA Webhook connected to your Bybit Account.

Step 1: Connect your Bybit account

  1. Go to TradingView To Anywhere and select Bybit.
  2. Click Connect and enter your Bybit API Key and API Secret. To generate these, go to Bybit → Account → API Management, create a new key, and enable Read and Trade permissions.
  3. (Recommended) Restrict the API key to TTA’s IP address — 34.89.98.97 — for extra security.
  4. Copy the webhook URL TTA generates. This is what goes into your TradingView alert.

Step 2: Build your alert message

Commands follow the format action symbol param=value. A few rules to keep in mind:

  • Symbols are case-sensitive and must match Bybit exactly — BTCUSDT, not btcusdt.
  • No spaces around the = — Q=50% is valid, Q = 50% is not.
  • Parameters can be written in full or abbreviated to their first letter (Quantity or Q).
  • You can stack up to 5 commands in one alert, each on its own line.

Opening a trade

Buy/Long/1 and Sell/Short/-1 open positions. Key parameters:

  • Quantity (Q or OQ) — order size in tokens or % of balance
  • Category (C) — Spot, Linear, or Inverse. Default: Linear
  • Price (P) — entry price for limit orders, fixed or % offset from market
  • Price Trigger (PT) — trigger price for conditional limit orders, fixed or % offset
  • Leverage (L) — sets leverage
  • Take Profit (TP) / Stop Loss (SL) — price or % of entry
  • Trailing Distance (TD) — trailing stop trigger distance, % or price offset
  • Hedge (H) — hedge mode, can be passed with or without a value
  • Balance (B) — Free or Total
  • Delay (D) — delays execution up to 5 seconds
Long BTCUSDT Q=0.01 L=10 C=Linear

Enters a long futures position at market price, 0.01 BTC, 10x leverage.

Buy SOLUSDT Q=0.1 P=150 C=LINEAR SL=160 TP=300

Places a buy limit futures order at 150, with take profit at 300 and stop loss at 160.

BUY BTCUSDT Q=50% TD=1% B=FREE

Buys BTC using 50% of free balance and sets a trailing stop 1% from entry.

{{strategy.market_position}} BTCUSDT OQ=2% SL={{plot('mySL')}} TP={{plot('myTP')}}

Opens a futures trade sized at 2% of USDT balance, with SL/TP pulled dynamically from your script’s plots.

Modifying an open trade

Modify/Update adjust TP, SL, or trailing distance on an existing futures position without closing it.

UPDATE BTCUSDT TP=3% SL=2%

Updates take profit and stop loss on all open BTCUSDT futures trades.

MODIFY BTCUSDT TD=100

Updates the trailing stop distance.

Closing a trade

Close/Flat/0 exit a position, fully or partially.

  • Q / CQ — size to close, tokens or %. Default: 100%
  • Type (T) — direction to close, buy or sell
  • Running Profit (RP) / Running Loss (RL) — only close once unrealised profit/loss reaches this threshold (USDT)
flat SOLUSDT Q=0.1 T=short

Closes 0.1 SOL of open short positions.

CLOSE BTCUSDT RP=500

Closes BTCUSDT only once unrealised profit hits 500 USDT or more — useful for locking in gains without watching the chart.

Cancelling a pending order

Cancel/Exit cancel unfilled orders. Takes a Category (C) parameter (Spot or Futures, default linear).

Exit ETHUSDT C=SPOT

Cancels all pending ETHUSDT spot orders.

Balance check

Balance/Bal/Funds return your account balance. Takes Balance (B) (Free or Total, default Free) and Category (C).

Balance b=Free c=linear

Returns the free balance across your unified futures account.

Step 3: Wire the alert into TradingView

  1. Set your alert condition as usual, then enable the Webhook option.
  2. Paste your TTA Bybit webhook URL into the webhook field.
  3. Enter your command in the alert message.

For strategy alerts, {{strategy.order.action}} returns “buy”/“sell” for the executed order, while {{strategy.market_position}} returns the strategy’s current state (“long”/“flat”/“short”) — use the second if your strategy also generates a close/exit signal.

Trading manually instead of from a strategy? The TTA Chrome extension’s Alert Detector can forward alerts to your webhook without you needing to edit the alert itself.

Step 4: Test before you trust it

  1. Trigger a test alert manually from TradingView.
  2. Confirm the order appears on Bybit with the correct size, category (spot vs. futures), leverage, and TP/SL.
  3. If you’re using trailing stops or RP/RL close filters, verify they behave as expected before relying on them live.

Common mistakes

  • Case-sensitive symbols — btcusdt is rejected; it has to match Bybit’s exact casing, BTCUSDT.
  • Wrong Category (C) — forgetting to set C=Spot when you meant to trade spot (or leaving it off and defaulting to Linear futures) sends the order to the wrong market entirely.
  • RP/RL on the wrong command — running profit/loss filters only apply to close commands, not opens.
  • Webhook URL typos — copy-paste rather than retype; one wrong character means the alert never arrives.

Ready to connect your account? Start today →