Skip to main content

Alert Request Format v1.0.x

Version Note: This format is for XeroLite version 1.0.0 Beta (released 2024-12-02). Version 1.0.0 Beta introduced limit orders, take profit, and stop loss. The first stable release with these features is version 1.1.0 (released 2025-05-23). We recommend using version 1.1.0 or higher for production use. See Alert Request Format v1.1.x for the stable version.

This guide details the required JSON format for TradingView alerts to work with XeroLite v1.0.0 Beta. Each field in the alert message must follow the specified format below.

Built-in Tools to Help You

  • Alert Request Builder: Use Xerolite's built-in tool to easily construct your alert requests in the correct JSON format.
  • Alert Message Validator & Sender: Test and validate alert messages and send test orders directly to XeroLite. See Alert Message Validator & Sender for details.

Important Note About Alert Names

When multiple orders share the same alert name, they are considered part of the same trading strategy. This ensures accurate profit/loss tracking and allows the system to manage pending orders effectively. Always use consistent alert names for related orders.

Field Reference Table

FieldDescriptionMandatoryTradingView PlaceHolder
nameThe alert name is a critical identifier that groups related orders together. It is used for PnL calculation and order management.Yes
symbolThe stock ticker symbol (e.g., 'AAPL').Yes
currencyThe currency of the trade (e.g., 'USD').Yes{{syminfo.currency}}
asset_classThe class of the asset, e.g., 'STOCK', 'FOREX', 'FUTURE', or 'INDEX'.Yes
exchThe exchange where the order will be placed (e.g., 'SMART' for US STOCK).Yes
acc_noIB account number. Required only if multiple accounts are linked to the same TWS login. If a single account is used, this field is optional and will be ignored if provided.No
actionThe order action, either 'BUY' or 'SELL'.Yes{{strategy.order.action}}
qtyThe quantity of the asset to trade (e.g., '10.00').Yes{{strategy.order.contracts}}
tifTime-in-Force for the order, such as 'DAY' or 'GTC' (Good Til Cancel) or 'IOC' (Immediate or Cancel). Default to 'DAY' if not specified.No
order_typeThe type of order, such as 'LIMIT', 'MARKET'. Default to 'MARKET' if not specifiedNo
priceThe price for the order if 'order_type' is 'LIMIT' (e.g., '210.00'). Mandatory if 'order_type' = 'LIMIT': Acts as the limit price for the order. If sl_offset or tp_offset is configured, stop-loss and take-profit offsets will be calculated based on this price. Mandatory for 'MARKET' orders if sl_offset or tp_offset is configured as it will be used for stop-loss and take-profit calculations. The price will be rounded to the nearest valid increment based on IB market rules for LIMIT orders. For MARKET orders, the price is not rounded (only used for offset calculations).Yes (with conditions){{strategy.order.price}}
slThe stop-loss price for the order (e.g., '110.00'). Note: This field is NOT rounded when provided directly. To ensure automatic price rounding, use sl_offset instead.No
sl_offsetThe stop-loss offset as a percentage or fixed value. Will be ignored if 'sl' is configured. Examples: '10%': Calculates stop-loss dynamically based on the percentage of the price. BUY: SL = Price – (Price × 10%) SELL: SL = Price + (Price × 10%) '25.00': Fixed value offset. BUY: SL = Price – 25.00 SELL: SL = Price + 25.00 The calculated price will be rounded to the nearest valid increment based on IB market rules.No
tpThe take-profit price for the order (e.g., '130.00'). Note: This field is NOT rounded when provided directly. To ensure automatic price rounding, use tp_offset instead.No
tp_offsetThe take-profit offset as a percentage or fixed value. Will be ignored if 'tp' is configured. Examples: '10%': Calculates take-profit dynamically based on the percentage of the price. BUY: TP = Price + (Price × 10%) SELL: TP = Price – (Price × 10%) '29.00': Fixed value offset. BUY: TP = Price + 29.00 SELL: TP = Price – 29.00 The calculated price will be rounded to the nearest valid increment based on IB market rules.No

Price Rounding Rules

Note: Automatic price rounding was introduced in version 1.1.0. In version 1.0.0 Beta, you may need to manually ensure prices comply with IB market rules. We recommend upgrading to version 1.1.0 or higher for automatic price rounding.

For limit orders, stop-loss, and take-profit prices in version 1.1.0+, XeroLite will automatically round prices to the nearest valid increment based on Interactive Brokers market rules. This ensures your orders comply with exchange requirements.

For detailed information about how price rounding works, see Price Rounding Rules.

Need Help?

If you encounter any issues or need assistance, please contact our support team at [email protected]