How to set a stop loss on Hyperliquid (stop market, stop limit, TP/SL and trailing stops)
Updated Nov 18, 2026 · 5 min read
Set a stop loss on Hyperliquid with TP/SL on the position, a Stop Market or Stop Limit order with Reduce Only, or a native Trailing Stop. App steps, Python code, liquidation distances and risks.
How do you set a stop loss on Hyperliquid? Add TP/SL to the open position, or place a Stop Market or Stop Limit order on the closing side with Reduce Only. TP/SL orders trigger on the mark price, a market TP/SL fills within a 10% slippage tolerance, and perps also have a native Trailing Stop.
Key takeaways
- Four ways: TP/SL on the position or on the order, a Stop Market or Stop Limit with Reduce Only, or a Trailing Stop.
- On Nov 18, 2026, an 8.9% drop would liquidate a new 10x isolated BTC long, so the stop has to sit closer.
Which stop orders does Hyperliquid support?
- Stop Market: a market order activated at your trigger price. A sell stop needs a trigger below the mid price, a buy stop one above it.
- Stop Limit: a limit order activated at the trigger, so you also set the worst price you accept.
- Trailing Stop (perps only): a market order that fires when the mark price retraces from its best level by your distance or percentage (trailing stops explained).
- Reduce Only: the order can only shrink a position, never open the opposite one (all order types).
Set it in the Hyperliquid app
- 01Add TP/SL on the position. It covers the entire position by default; a size you set stays fixed and does not resize with the position.
- 02For a trailing stop, choose Trailing Stop and set the retracement as a distance or percentage, with an optional activation price.
TP/SL set in the order form
Set it in code (Python SDK, testnet)
Via the API, a stop is a reduce-only trigger order with tpsl: "sl"; trailing stops use a separate trailingStop action, with no helper in SDK 0.24.0. The script sends nothing without HL_SEND=1 and a testnet key.
# Attach a stop loss to an open ETH position on Hyperliquid TESTNET.
# Dry run by default: reads testnet prices and prints the order it would send.
# To send: HL_SEND=1 and HL_TESTNET_KEY=<a testnet-only private key>.
# Tested (dry run) with hyperliquid-python-sdk 0.24.0 and Python 3.9.6 on Nov 18, 2026.
import json
import os
from hyperliquid.info import Info
from hyperliquid.utils import constants
from hyperliquid.utils.signing import order_request_to_order_wire, order_wires_to_order_action
COIN = "ETH"
DRY_RUN_SIZE = 0.01 # pretend long of 0.01 ETH when nothing is sent
STOP_PCT = 0.05 # stop 5% away from the current mid price
IS_MARKET = True # True = Stop Market, False = Stop Limit at limit_px
LIMIT_PCT = 0.10 # Stop Limit: limit price 10% beyond the trigger
SEND = os.environ.get("HL_SEND") == "1"
info = Info(constants.TESTNET_API_URL, skip_ws=True)
sz_decimals = next(a["szDecimals"] for a in info.meta()["universe"] if a["name"] == COIN)
mid = float(info.all_mids()[COIN])
def px(p):
"""Hyperliquid price rules: 5 significant figures, at most 6 - szDecimals decimals."""
return round(float(f"{p:.5g}"), 6 - sz_decimals)
size = DRY_RUN_SIZE
if SEND:
import eth_account
from hyperliquid.exchange import Exchange
wallet = eth_account.Account.from_key(os.environ["HL_TESTNET_KEY"])
positions = info.user_state(wallet.address)["assetPositions"]
size = next((float(p["position"]["szi"]) for p in positions if p["position"]["coin"] == COIN), 0.0)
if size == 0:
raise SystemExit(f"No open {COIN} position on testnet; nothing to protect.")
is_long = size > 0
sign = -1 if is_long else 1 # a long's stop sits below the mid, a short's above
trigger = px(mid * (1 + sign * STOP_PCT))
limit = px(trigger * (1 + sign * LIMIT_PCT))
order = {
"coin": COIN,
"is_buy": not is_long, # sell to close a long, buy to close a short
"sz": abs(size),
"limit_px": limit,
"order_type": {"trigger": {"triggerPx": trigger, "isMarket": IS_MARKET, "tpsl": "sl"}},
"reduce_only": True, # can only shrink the position, never flip it
}
print(f"testnet mid {COIN} = {mid}, stop trigger = {trigger}, limit = {limit}")
if SEND:
print(Exchange(wallet, constants.TESTNET_API_URL).order(**{"name": order.pop("coin"), **order}))
else:
wire = order_request_to_order_wire(order, info.name_to_asset(COIN))
print("DRY RUN, nothing sent. Action:")
print(json.dumps(order_wires_to_order_action([wire], None, "na"), indent=1))Not executed for this guide
How far away is liquidation?
| Market | Max leverage | Drop that liquidates a new long: 3x / 5x / 10x / 20x |
|---|---|---|
| BTC | 40x | 32.5% / 19.0% / 8.9% / 3.8% |
| ETH | 25x | 32.0% / 18.4% / 8.2% / 3.1% |
| SOL | 20x | 31.6% / 17.9% / 7.7% / 2.6% |
| HYPE | 10x | 29.8% / 15.8% / 5.3% / n/a |
A stop beyond these distances would trigger only after liquidation. With cross margin, the liquidation price depends on account value and other cross positions, not the leverage you set (liquidation map).
What can go wrong
- Gaps. Hyperliquid's example: a long's stop with trigger and limit at $10 likely rests unfilled if the price drops from $11 to $9 at once; with an $8 limit it likely fills between $9 and $8.
- Mark vs book. In fast markets or on highly leveraged positions, the mark price can differ significantly from the book price you fill at.
Stops on Senpi
Senpi, which publishes this guide, is an AI trading agent for Hyperliquid. For a single trade, the agent can attach a stop to the position. Strategies built from a rule or a template carry the Dynamic Stop-Loss (DSL), a stop that ratchets up as the trade gains, from the first fill, and each can have its own daily-loss halt, which lifts at the next UTC midnight, or a drawdown halt, which waits until you resume it. Copy strategies carry at most a flat stop.
What price triggers a stop loss on Hyperliquid?
The mark price, a median of an oracle-based price, Hyperliquid's book and other exchanges' perp prices, updated about every 3 seconds. The order then fills on Hyperliquid's book.
Can an AI agent set the stop for me?
Yes. On Senpi, the agent can attach a stop to the position.
Sources: Hyperliquid docs, checked Nov 18, 2026: order types, TP/SL, trailing stops, liquidations, mark price, exchange endpoint; hyperliquid-python-sdk 0.24.0; Hyperliquid info API, Nov 18, 2026.
This is educational material, not financial advice; leveraged perps can lose money quickly.
Trade with a stop attached
The agent can attach a stop to the position, and rule and template strategies carry the Dynamic Stop-Loss from the first fill.
Related articles
Opening, Editing, Closing, and Canceling Positions
Positions open from a strategy wallet, not your Main Wallet. Partial closes go through resize, not close. Plus why exit price differs from mark.
Risk management for crypto perps: a checklist with Hyperliquid data
A seven-point risk checklist for crypto perps: size from the stop, leverage vs liquidation, stop placement, funding, correlation, daily loss and drawdown limits, with 30 days of Hyperliquid data.
Tradeable Assets: Crypto, Equities, and XYZ DEX
301 Hyperliquid perps on Nov 18, 2026: 179 crypto and 122 XYZ stocks, indices, commodities and FX, with leverage limits, margin modes and symbols.