Home  ›  SignalPipe  ›  Documentation  ›  The Sell Flow

The Sell Flow

The Sell Flow

When SignalPipe receives a sell signal, it closes all sub-positions for the specified instrument.

Sell Execution Steps

  1. Close all sub-positions -- Each open sub-position in the deal is individually closed on Capital.com. This is necessary because Capital.com manages each DCA position as a separate deal.
  2. Collect profit data -- Capital.com returns profit/loss data for each closed sub-position in the confirmation response.
  3. Calculate total P&L -- The realized profit or loss is summed across all closed sub-positions.
  4. Mark deal as completed -- The deal status is updated to "completed" with the close timestamp and total realized P&L.
  5. Log the closure -- A detailed log entry records the P&L, number of sub-positions, and ladder depth.

Example: Sell Flow

  • Active deal: AAPL, 2 sub-positions (base + 1 safety order), 25 total units, avg entry $144.00
  • Sub-positions closed individually on Capital.com
  • Combined P&L from confirmations: +$100.00
  • All sub-positions marked CLOSED
  • Deal marked completed

Edge Cases

No Active Deal Found

If a sell signal arrives but there is no active deal in the database for that instrument, a warning is logged noting that no matching deal was found. This can happen if:

  • The deal was already completed by a take-profit fill
  • The deal was closed manually on Capital.com
  • The position was opened outside of SignalPipe

Position Already Closed

If a Capital.com sub-position was already closed (for example, by a TP level being hit), the close request may return an error. SignalPipe handles this gracefully -- it logs the situation and continues processing the remaining sub-positions.

This is a static view of a single section. For full search and interactivity visit the docs app. Open interactive docs →