Bybit perpetuals command reference
This is the full reference for writing Bybit perpetual orders from an Autoview alert, using e=BYBIT. The perpetual surface is the richest of any exchange Autoview supports, with one-order brackets, conditional entries, trailing stops, and leverage. It goes parameter by parameter and order type by order type, and for each one it shows the exact order Bybit resolves, not just the command you type. If you trade Bybit spot instead, that is a smaller surface with its own page: the Bybit spot command reference.
On Bybit, the symbol is BTCUSDT, one word, no separator. The examples below use BTCUSDT, the USDT linear perpetual. The one thing to read carefully if you have used another exchange: Bybit attaches a stop or target to the entry order itself rather than placing a separate opposite order. If you know Kraken, that is the reverse of what you expect, so read the bracket section.
- How Autoview reads a command
- The parameter table
- Order types and what each resolves to
- The one-order bracket: attached stop and target
- Conditional entries
- Trailing stops
- Trigger price source: last, index, mark
- Sizing: base units, percent, and notional
- Margin and modifiers
- Cancelling and closing
- Moving balances between wallets
- What Bybit does not accept
- Testing and going live
How Autoview reads a command
A command is a single line of key=value tokens separated by spaces. e=BYBIT s=BTCUSDT b=sell t=market q=0.001 is five tokens. The order you write them in does not matter.
- First occurrence wins. If a key appears twice, Autoview keeps the first and ignores the rest. Write each key once.
- A line starting with
//is a comment and places nothing. Useful for labelling an alert without triggering a trade. - You can send several commands at once by separating them with a new line or a pipe (
|). Each is parsed on its own. - A token that starts with a colon is ignored. TradingView sometimes inserts placeholder tokens like
:plot_0=; Autoview skips anything with a leading colon so those never affect the order.
Four tokens matter for every order: e=BYBIT (the perpetual product line), s= (the symbol), b= (the side), and q= (the size). The size is not optional in practice. Read the sizing section before you send a real order.
The parameter table
These are the parameters Bybit perpetuals read, grouped by what they do.
Routing and identity
| Parameter | Meaning |
|---|---|
e= | The product line. e=BYBIT is perpetuals, both linear (for example BTCUSDT) and inverse. |
s= | The symbol, for example s=BTCUSDT. Required. |
Direction and size
| Parameter | Meaning |
|---|---|
b= | Side: b=buy or b=sell. Required, no default. |
q= | Quantity, in base units (the BTC in BTCUSDT), for example q=0.001. A percent of balance also works (q=50%), and u=currency reads it as a notional amount instead. It defaults to 100% of your balance when omitted, so set it on every order. |
u=currency | Read q= as a notional amount in the quote currency rather than base units. q=100 u=currency commits about 100 USDT, which Bybit converts to the base quantity at the current price. |
Order type and price
| Parameter | Meaning |
|---|---|
t= | Order type: market, limit, ioc (immediate-or-cancel), fok (fill-or-kill), or post (post-only maker). Defaults to limit, so market orders set it explicitly. |
fp= / p= | Limit price. fp= is a fixed, absolute price; p= is an offset from a reference (see relative pricing). |
fpx= / px= | Trigger price for a conditional entry. fpx= is absolute; px= is an offset. The side stays as you wrote it. See conditional entries. |
fsl= / sl= | Stop-loss price, attached to the entry order. On Bybit this rides along on the same order as the position's protective stop, and the side does not flip. See the bracket section. |
ftp= / tp= | Take-profit price, attached to the entry order, again on the same order with the side unchanged. |
fts= / ts= | Trailing stop distance. fts= is an absolute distance; ts= is relative. |
ftsx= / tsx= | Activation price for a trailing stop: the price the trail starts following from. |
price= | A reference price the relative parameters (p=, px=) offset from. Use price={{close}} in a TradingView alert. |
Trigger source and mode
| Parameter | Meaning |
|---|---|
pxs= / sls= / tps= | Which price a trigger watches: last (default), index, or mark. pxs= is for the entry trigger, sls= for the stop, tps= for the target. |
mode= | Take-profit and stop-loss mode: partial lets a stop or target close part of the position, full closes all of it. |
Margin and modifiers
| Parameter | Meaning |
|---|---|
l= | Leverage, for example l=5. Bybit applies it to the position through a separate call, so it sets the leverage the position uses rather than appearing on the order itself. l=0 selects cross margin. |
ro= | Reduce-only. ro=1 marks the order so it can only shrink a position, never extend it. |
cot= | Close-on-trigger. cot=1 marks a conditional order so it only closes a position when it fires. |
hedge= | Hedge mode. In hedge mode a symbol can hold a long and a short at once; hedge=1 tags the order to the matching side. |
Cancelling, closing, and wallets
| Parameter | Meaning |
|---|---|
c= | Cancel or close. c=order cancels your resting orders on the symbol. c=position closes a perpetual position. c=all is not available on Bybit. |
cm= / cmo= | Act on a subset: cm= is how many (a count or a percent), cmo= is which ones (newest, oldest, and so on). |
w= / y= | Move balances between account types. w= is the coin (for example w=USDT) and y= is the destination type (for example y=UNIFIED). |
d= | Dry run. d=1 parses and reports the order but places nothing. |
Order types and what each resolves to
Here is each order type with the command on the left and the order Bybit actually built on the right. The resolved time-in-force is the useful part: it shows that a market order runs as immediate-or-cancel, that t=post becomes a limit with a post-only flag, and so on.
| Command | Bybit resolves |
|---|---|
e=BYBIT s=BTCUSDT b=sell t=market q=0.001 | Market sell, time-in-force immediate-or-cancel. |
e=BYBIT s=BTCUSDT b=sell t=limit fp=200000 q=0.001 | Limit sell at 200000, good-till-cancelled. |
e=BYBIT s=BTCUSDT b=sell t=ioc fp=200000 q=0.001 | Limit at 200000, immediate-or-cancel: fills what it can at once and cancels the rest. |
e=BYBIT s=BTCUSDT b=sell t=fok fp=200000 q=0.001 | Limit at 200000, fill-or-kill: fills in full at once or not at all. |
e=BYBIT s=BTCUSDT b=sell t=post fp=200000 q=0.001 | Post-only limit at 200000: it joins the book as a maker order and is rejected rather than crossing the spread. |
Bybit gives you both immediate-or-cancel and fill-or-kill, which not every exchange does. The next sections cover the parts that make the perpetual surface the richest one.
The one-order bracket: attached stop and target
This is the feature that sets Bybit apart, and the one to read carefully if you have used another exchange. On Bybit perpetuals a stop-loss and a take-profit ride along on the entry order itself. You send one order, and the stop and the target are attached to the position it opens. The side does not flip.
| Command | Bybit resolves |
|---|---|
e=BYBIT s=BTCUSDT b=buy t=market fsl=50000 q=0.001 | Market buy with a stop-loss attached at 50000. The order stays a buy; the stop rides along as the position's protective stop. |
e=BYBIT s=BTCUSDT b=buy t=market ftp=200000 q=0.001 | Market buy with a take-profit attached at 200000, again on the same buy order. |
e=BYBIT s=BTCUSDT b=buy t=market fsl=50000 ftp=200000 q=0.001 | Market buy with both a stop at 50000 and a target at 200000 attached. One command, one order, a complete bracket. |
This is the reverse of Kraken. On Kraken, fsl= and ftp= flip to the opposite side and become separate close orders. On Bybit they stay on your side and attach to the entry. If you are moving an alert between the two, the command looks the same but the result is not, so check the resolved order with d=1 first.
Conditional entries
A conditional entry waits for the price to reach a trigger before it places. You add fpx= (absolute) or px= (relative) to a market or limit order, and the side stays as you wrote it, because this is an entry, not an exit.
| Command | Bybit resolves |
|---|---|
e=BYBIT s=BTCUSDT b=buy t=market fpx=200000 q=0.001 | Conditional market buy that arms at 200000. Bybit works out whether the trigger is above or below the current price and sets the direction for you. The side stays buy. |
e=BYBIT s=BTCUSDT b=buy t=limit fp=205000 fpx=200000 q=0.001 | Conditional limit buy: arms at 200000 and then rests a limit at 205000. The side stays buy. |
Use a conditional entry to enter on a breakout or a break-down, where you want the order to wait until the market confirms the move.
Trailing stops
A trailing stop follows the price by a fixed distance and locks in gains as the position moves your way. fts= sets the distance, and ftsx= sets the price the trail starts following from.
| Command | Bybit resolves |
|---|---|
e=BYBIT s=BTCUSDT b=buy t=market fts=500 q=0.001 | Market buy with a trailing stop 500 behind the price. |
e=BYBIT s=BTCUSDT b=buy t=market fts=500 ftsx=70000 q=0.001 | Market buy with a trailing stop of 500 that starts following once the price reaches 70000. |
Trigger price source: last, index, mark
Every trigger on Bybit can watch one of three prices, and you choose which. The default is the last traded price. The index price is an average across exchanges, and the mark price is the one Bybit uses for liquidation, so it is steadier than the last trade.
| Command | Bybit resolves |
|---|---|
e=BYBIT s=BTCUSDT b=buy t=market fpx=200000 pxs=index q=0.001 | Conditional buy whose trigger watches the index price rather than the last trade. |
pxs= sets the source for an entry trigger, sls= for a stop, and tps= for a target. Watching the index or mark price helps a trigger ignore a brief wick on a single venue.
Sizing: base units, percent, and notional
q= sets the size, and it reads three ways.
- A plain number is base units.
q=0.001is 0.001 BTC onBTCUSDT, passed straight through. - A percent is a share of your balance, sized at the current price.
q=50%commits half of the relevant balance. - With
u=currency, the number is a notional amount in the quote currency.q=100 u=currencycommits about 100 USDT, which Bybit converts to a sub-one BTC quantity at the current price.
Leave q= off and Autoview uses 100% of the balance. This is the single most important line on the page. An order with no q= commits your entire balance. Set the size you mean, explicitly, on every order, every time.
Margin and modifiers
| Command | Bybit resolves |
|---|---|
e=BYBIT s=BTCUSDT b=buy t=market q=0.001 l=5 | Market buy with the position set to 5x leverage. Bybit applies the leverage through a separate call, so it sets the position's leverage rather than showing on the order. |
e=BYBIT s=BTCUSDT b=sell t=market q=0.001 ro=1 | Market sell marked reduce-only, so it can only shrink a position. |
e=BYBIT s=BTCUSDT b=sell t=market q=0.001 cot=1 | Market sell marked close-on-trigger. |
l=0 selects cross margin. hedge=1 tags an order to the matching side when the symbol is in hedge mode, where a long and a short can be held at once.
Cancelling and closing
How you close depends on what you are closing. You cancel resting orders, and you close a position.
| Command | Effect |
|---|---|
e=BYBIT s=BTCUSDT c=order | Cancel your resting orders on the symbol. |
e=BYBIT s=BTCUSDT c=position | Close your open perpetual position on the symbol. |
There is no c=all on Bybit. Cancel orders with c=order and close a position with c=position. When you have several resting orders, cm= and cmo= act on a subset: cm= is how many (a count or a percent) and cmo= is which ones, by newest, oldest, and so on.
Moving balances between wallets
Bybit keeps balances in account types, and a command can move balance between them. w= names the coin and y= names the destination.
e=BYBIT w=USDT y=UNIFIED q=1That moves 1 USDT into the unified account. The amount follows the same rules as an order size, so set it explicitly.
What Bybit does not accept
A few things look like they should work and do not. Knowing them saves a debugging session.
- No attached stop-limit or target-limit. The plain attached stop (
fsl=) and target (ftp=) work, but the limit-price variants do not register, so the stop and target run as triggers, not as resting limits. - No
c=all. Cancel orders withc=orderand close a position withc=position. - One command, one account. You cannot list several accounts with
a=acct1,acct2; send a separate command per account.
If you trade spot, note that most of the perpetual surface above does not carry over: conditional entries do, while brackets, trailing stops, and leverage stay perpetual-only. See the Bybit spot command reference for what spot accepts and what it quietly drops.
Testing and going live
Append d=1 to any command and Autoview parses it, reports what it would have done, and places nothing:
e=BYBIT s=BTCUSDT b=sell t=market q=0.001 d=1That is the safest first run for a command you have just written. Read the log, confirm the symbol and side are right and the size is what you meant, then drop d=1 to send it for real. Bybit orders are real money from the first fill on the live exchange, so keep your first live size small and grow it once the alert behaves. For more on reading the log, see test and debug your setup.