Targeted Partial Close Using Comment (Indicator Alerts Only)

2 min read

This feature allows you to selectively close specific open positions when trading with indicator-based alerts. By using a unique comment value when entering trades, you can later send a close alert targeting only that particular entry.

Important: This feature is available for indicator alerts only — not for TradingView strategies.


1. How It Works #

When placing an order via an indicator alert, attach a unique comment field. Each entry is then tagged for identification.

Example: Opening Two Buy Orders #

{
  "symbol": "NQ1!",
  "data": "buy",
  "comment": "buy1",
  "quantity": 1,
  "order_type": "MKT"
}
{
  "symbol": "NQ1!",
  "data": "buy",
  "comment": "buy2",
  "quantity": 1,
  "order_type": "MKT"
}

Here, two separate Buy positions are opened with comments buy1 and buy2.


Example: Closing a Specific Position #

If you only want to close the second Buy position (buy2), send:

{
  "symbol": "NQ1!",
  "data": "close",
  "comment": "buy2",
  "full_closed": false,
  "quantity": 1,
  "order_type": "MKT",
  "price": "19950",
  "stp_limit_stp_price": 19950,
  "tp": 0,
  "sl": 0,
  "risk_percentage": 0,
  "dollar_tp": 0,
  "dollar_sl": 0,
  "percentage_tp": 0.2,
  "percentage_sl": 0.2,
  "trail": 0,
  "trail_stop": 0,
  "trail_trigger": 0,
  "trail_freq": 0,
  "gtd_in_second": 0,
  "same_direction_ignore": false,
  "advance_tp_sl": [],
  "update_tp": false,
  "update_sl": false,
  "reverse_order_close": false
}

Result: Only the buy2 order is closed. The buy1 order remains open.


Closing the Entire Position #

To flatten all open Buy positions, regardless of their comment values, use:

"full_closed": true

Result: Every Buy order is closed, no matter how many separate entries exist.


2. Key Benefits #

  • Precision Control – Close only the entries you want without affecting other positions.
  • Scalability – Manage multiple layered entries in the same direction.
  • Flexibility – Decide between partial targeted close (by comment) or full close (using full_closed: true).

3. Limitations #

  • Works only for indicator alerts.
  • Not available in TradingView strategy-based alerts (to prevent position mismatch issues).

4. Summary #

With Targeted Partial Close, you can manage complex multi-entry positions more effectively by tagging each order with a comment. This lets you close individual trades selectively or flatten everything at once—giving you full control over your automated execution.