Skip to main content

Combo Order Types

XeroLite supports various order combinations that create parent-child order relationships. Understanding how these combinations work is crucial for effective order management.

Overview

When you create an order with XeroLite, the system can generate multiple related orders depending on your configuration:

  • Parent Order: The primary order (e.g., MARKET, LIMIT, or TRAIL)
  • Child Orders: Dependent orders that are linked to the parent (e.g., STOP-LOSS, TAKE-PROFIT, TRAIL)

Child orders are automatically managed and will be canceled if the parent order is canceled or fails to execute.

Version Requirements

  • Stop-Loss and Take-Profit: Available in version 1.0.0 Beta and above (stable in version 1.1.0 and above)
  • Trail Orders: Available in version 1.2.0 and above
  • Limit Orders: Available in version 1.0.0 Beta and above (stable in version 1.1.0 and above)

Note: Version 1.0.0 Beta introduced limit orders, stop-loss, and take-profit. The first stable release with these features is version 1.1.0. We recommend using version 1.1.0 or higher for production use.

Make sure you're using the correct XeroLite version to access these features. Check your version in the XeroLite interface or contact support if you need to upgrade.


1. Simple Market Order

When you specify order_type: "MARKET" without any stop-loss (SL) or take-profit (TP) parameters, XeroLite creates a single market order.

Example

{
"name": "AAPL_Market",
"symbol": "AAPL",
"action": "BUY",
"qty": "10",
"order_type": "MARKET",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART"
}

Result

Creates 1 market order that executes immediately at the current market price.


2. Simple Limit Order

When you specify order_type: "LIMIT" with a price, without any SL or TP parameters, XeroLite creates a single limit order.

Example

{
"name": "AAPL_Limit",
"symbol": "AAPL",
"action": "BUY",
"qty": "10",
"order_type": "LIMIT",
"price": "150.00",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART"
}

Result

Creates 1 limit order at $150.00. The order will execute when the market price reaches or goes below $150.00 (for a BUY order).


3. Market/Limit Order with Stop-Loss and/or Take-Profit

Version Requirement: Stop-Loss and Take-Profit features are available in version 1.0.0 Beta and above (stable in version 1.1.0 and above). We recommend using version 1.1.0 or higher for production use.

When you attach SL or TP (or both) to a MARKET or LIMIT order, XeroLite creates a parent order and child orders for the stop-loss and/or take-profit.

Example 1: Market Order with SL and TP

{
"name": "AAPL_Market_SL_TP",
"symbol": "AAPL",
"action": "BUY",
"qty": "10",
"order_type": "MARKET",
"price": "150.00",
"sl_offset": "5%",
"tp_offset": "10%",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART"
}

Result

Creates 3 orders:

  1. 1 parent MARKET order - Executes immediately at market price
  2. 1 child STOP-LOSS order - Calculated as Price - 5% (e.g., $150.00 - $7.50 = $142.50)
  3. 1 child TAKE-PROFIT order - Calculated as Price + 10% (e.g., $150.00 + $15.00 = $165.00)

Example 2: Limit Order with SL only

{
"name": "AAPL_Limit_SL",
"symbol": "AAPL",
"action": "BUY",
"qty": "10",
"order_type": "LIMIT",
"price": "150.00",
"sl": "142.50",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART"
}

Result

Creates 2 orders:

  1. 1 parent LIMIT order at $150.00
  2. 1 child STOP-LOSS order at $142.50

The stop-loss order will be placed once the limit order is filled.

Example 3: Market Order with TP only

{
"name": "AAPL_Market_TP",
"symbol": "AAPL",
"action": "BUY",
"qty": "10",
"order_type": "MARKET",
"price": "150.00",
"tp": "165.00",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART"
}

Result

Creates 2 orders:

  1. 1 parent MARKET order - Executes immediately
  2. 1 child TAKE-PROFIT order at $165.00

4. Trail Order

Version Requirement: Trail orders are available in version 1.2.0 and above.

When you specify order_type: "TRAIL" with trail_amt, XeroLite creates a limit order and a trailing stop order.

Example

{
"name": "AAPL_Trail",
"symbol": "AAPL",
"action": "BUY",
"qty": "10",
"order_type": "TRAIL",
"price": "150.00",
"trail_amt": "2.00%",
"currency": "USD",
"asset_class": "STOCK",
"exch": "SMART"
}

Result

Creates 2 orders:

  1. 1 LIMIT order at $150.00 (parent order)
  2. 1 TRAIL order with 2% trailing stop (child order)

How Trailing Stop Works

  • The trail order follows the market price with a 2% trailing distance
  • Once the limit order is filled, the trail order becomes active
  • As the price moves in your favor, the stop-loss price adjusts upward (for BUY) or downward (for SELL)
  • If the price reverses by 2%, the trailing stop order triggers

Trail Amount Format

The trail_amt field accepts:

  • Percentage: "2.00%" or "5%" - Trailing distance as percentage of price
  • Fixed Amount: "2.00" or "5" - Trailing distance as fixed dollar amount

Order Relationship Summary

Order TypeSL/TPResultOrders Created
MARKETNoneSimple market order1 (parent)
LIMITNoneSimple limit order1 (parent)
MARKETSL onlyMarket + Stop-Loss2 (1 parent + 1 child)
MARKETTP onlyMarket + Take-Profit2 (1 parent + 1 child)
MARKETSL + TPMarket + SL + TP3 (1 parent + 2 children)
LIMITSL onlyLimit + Stop-Loss2 (1 parent + 1 child)
LIMITTP onlyLimit + Take-Profit2 (1 parent + 1 child)
LIMITSL + TPLimit + SL + TP3 (1 parent + 2 children)
TRAILtrail_amtLimit + Trailing Stop2 (1 parent + 1 child)

Important Notes

Version Compatibility

  • Stop-Loss and Take-Profit: Available in version 1.0.0 Beta and above (stable in version 1.1.0 and above)
  • Trail Orders: Requires XeroLite version 1.2.0 or higher
  • Limit Orders: Available in version 1.0.0 Beta and above (stable in version 1.1.0 and above)
  • Simple Market Orders: Available in all versions

Important: Version 1.0.0 Beta introduced limit orders, stop-loss, and take-profit. The first stable release with these features is version 1.1.0. For production use, we recommend version 1.1.0 or higher.

If you're using an older version, upgrade to access these advanced order types. See Alert Request Format for version-specific field availability.

Price Field Requirements

  • MARKET orders: The price field is mandatory if sl_offset or tp_offset is configured, as it's used for calculating stop-loss and take-profit levels
  • LIMIT orders: The price field is always mandatory
  • TRAIL orders: The price field is mandatory for the initial limit order

Stop-Loss and Take-Profit Options

You can specify SL/TP using either:

  1. Fixed Price: "sl": "142.50" or "tp": "165.00"
  2. Offset (Percentage): "sl_offset": "5%" or "tp_offset": "10%"
  3. Offset (Fixed Amount): "sl_offset": "7.50" or "tp_offset": "15.00"

Note: If both sl and sl_offset are provided, sl takes precedence. Same applies to tp and tp_offset.

Child Order Management

Child orders (SL/TP/Trail) are linked to their parent order and will be managed automatically:

  • Automatic Linking: Child orders are automatically linked to their parent order
  • Automatic Cancellation: If the parent order is cancelled, child orders are also cancelled automatically
  • Activation Timing: Child orders are only activated after the parent order is filled
  • Visual Relationship: In the Transactions view, you can see the parent-child relationship with indentation and tree structure

Order Execution Flow

  1. Parent order executes first (MARKET executes immediately, LIMIT waits for price)
  2. Child orders are placed once the parent order is filled
  3. Child orders are linked to the parent - if parent is canceled, children are canceled
  4. Child orders execute independently once the parent is filled

Cancellation Behavior

  • If you cancel the parent order, all child orders are automatically canceled
  • If a child order is canceled manually, the parent order remains active
  • If the parent order fails to execute, child orders are not placed


Need Help?

If you have questions about combo orders or need assistance, contact support at [email protected]