NautilusTrader
ConceptsOrders
These docs track the unreleased nightly build and may change without notice. Switch to the latest stable docs.

Stop-Limit

FIX OrdType <40>=4 (Stop Limit)

A Stop‑Limit order releases a Limit order at the specified price when its trigger price is reached.

Use cases

Use a Stop‑Limit order when a stop trigger must also enforce a worst acceptable fill price, such as for a price‑protected exit or breakout entry. If the market gaps through both the trigger and limit, the order may not fill and can leave a position unprotected.

Example

The following example creates a Stop‑Limit order on the Currenex FX ECN to BUY 50,000 GBP at a limit price of 1.3000 USD once the market reaches 1.30010 USD. The order expires one hour after creation:

use nautilus_model::{
    enums::{OrderSide, TimeInForce, TriggerType},
    identifiers::InstrumentId,
    types::{Price, Quantity},
};

let expire_time = self.clock().timestamp_ns() + 3_600_000_000_000_u64;
let order = self.order().stop_limit(
    InstrumentId::from("GBP/USD.CURRENEX"),
    OrderSide::Buy,
    Quantity::from(50_000),
    Price::from("1.30000"),
    Price::from("1.30010"),
    Some(TriggerType::BidAsk), // optional (default DEFAULT)
    Some(TimeInForce::Gtd),    // optional (default GTC)
    Some(expire_time),         // one hour from now
    Some(true),                // post_only (default false)
    Some(false),               // 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
    None,                      // tags
    None,                      // client_order_id
);

See the StopLimitOrder API reference for further details.

  • Orders - Trigger types and other execution instructions.
  • Emulated orders - Emulating conditional orders on venues without native support.
  • Execution - How orders reach the venue and fills are handled.

On this page