Trailing-Stop-Market
FIX OrdType <40>=3 (Stop) + trailing peg
A Trailing‑Stop‑Market order keeps its stop trigger a fixed offset from the specified market price as the market moves favorably. It releases a Market order when triggered.
Use cases
Use a Trailing‑Stop‑Market order to protect gains while allowing a position to continue through favorable moves. A tight offset can trigger on ordinary volatility, while a wide offset can give back more profit. The released Market order can also slip, be rejected, or remain unfilled on a sharp reversal.
Example
In the following example we create a Trailing-Stop-Market order on the Binance Futures exchange to SELL 10 ETHUSD-PERP COIN_M margined Perpetual Futures Contracts. It activates at a price of 5,000 USD, then trails at an offset of 1% (in basis points) from the current last traded price:
use nautilus_model::{
enums::{OrderSide, TimeInForce, TrailingOffsetType, TriggerType},
identifiers::InstrumentId,
types::{Price, Quantity},
};
use rust_decimal::Decimal;
use ustr::Ustr;
let order = self.order().trailing_stop_market(
InstrumentId::from("ETHUSD-PERP.BINANCE"),
OrderSide::Sell,
Quantity::from(10),
Decimal::from(100), // trailing_offset
Some(TrailingOffsetType::BasisPoints), // optional (default PRICE)
Some(Price::from("5000")), // activation_price
None, // trigger_price (materializes from the offset on the first trail)
Some(TriggerType::LastPrice), // optional (default DEFAULT)
Some(TimeInForce::Gtc), // optional (default GTC)
None, // expire_time
Some(true), // reduce_only (default false)
None, // quote_quantity (default false)
None, // display_qty
None, // emulation_trigger
None, // trigger_instrument_id
None, // exec_algorithm_id
None, // exec_algorithm_params
Some(vec![Ustr::from("TRAILING_STOP-1")]), // tags
None, // client_order_id
);If both activation_price and trigger_price are omitted, the order activates immediately at the
current market and its trigger price materializes from trailing_offset on the first update.
See the
TrailingStopMarketOrder API reference
for further details.
Related guides
- Orders - Trigger and trailing offset types.
- Emulated orders - Emulating trailing stops on venues without native support.
- Execution - How orders reach the venue and fills are handled.