Alert Request Format v1.x

This guide details the required JSON format for TradingView alerts to work with Xerolite. 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 your orders before sending them to TradingView.

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 Description Mandatory TradingView PlaceHolder
name The alert name is a critical identifier that groups related orders together. It is used for PnL calculation and order management.
symbol The stock ticker symbol (e.g., ‘AAPL’).
currency The currency of the trade (e.g., ‘USD’). {{syminfo.currency}}
asset_class The class of the asset, e.g., ‘STOCK’, ‘FOREX’, ‘FUTURE’, or ‘INDEX’.
exch The exchange where the order will be placed (e.g., ‘SMART’ for US STOCK).
acc_no IB 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.
action The order action, either ‘BUY’ or ‘SELL’. {{strategy.order.action}}
qty The quantity of the asset to trade (e.g., ‘10.00’). {{strategy.order.contracts}}
tif Time-in-Force for the order, such as ‘DAY’ or ‘GTC’ (Good Til Cancel) or ‘IOC’ (Immediate or Cancel).
Default to ‘DAY’ if not specified.
order_type The type of order, such as ‘LIMIT’, ‘MARKET’.
Default to ‘MARKET’ if not specified
price The 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.
For limit order, the price will be rounded to the nearest valid increment based on IB market rules. Learn more.
{{strategy.order.price}}
sl The stop-loss price for the order (e.g., ‘110.00’).
The price will be rounded to the nearest valid increment based on IB market rules. Learn more.
sl_offset The 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 price will be rounded to the nearest valid increment based on IB market rules. Learn more.
tp The take-profit price for the order (e.g., ‘130.00’).
The price will be rounded to the nearest valid increment based on IB market rules. Learn more.
tp_offset The 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 price will be rounded to the nearest valid increment based on IB market rules. Learn more.

Need Help?

If you encounter any issues or need assistance, please contact our support team at support@xeroflex.com