> ## Documentation Index
> Fetch the complete documentation index at: https://docs.liftx.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Position targets and lifecycles

> Exact references, strategy exits, market exits, reusable keys, frozen target sets and ordering fences.

The opening policy and termination target answer different questions. Opening policy controls whether a new position may coexist with earlier work. A termination target selects which existing work an exit may affect. Neither turns Pine's local state into execution evidence.

## Three explicit termination targets

| UI choice | JSON `target` | Selected work | Required authority |
| - | - | - | - |
| **One strategy position** | `position` | One exact lifecycle from this setup, identified by client reference and immutable start | Terminate scope and matching ownership |
| **This strategy’s positions** | `strategy` | Eligible earlier lifecycles owned by this setup on its pinned market, including earlier accepted OPEN work | Terminate scope |
| **All positions in this market** | `market` | Captured matching Liftx positions on the exact link/instrument, including manual and other strategy positions | Terminate scope plus explicit market termination grant |

OPEN and MODIFY always address `position`. Group targeting is termination-only. Omitting a position reference never silently means all positions. Ordinary EXIT offers strategy or market; an exact prior lifecycle reference requires Pine or an external controller.

**Market** means the exact linked account plus canonical instrument, not every BTC symbol, all venues, all subaccounts or the entire portfolio. It selects Liftx-managed positions, not arbitrary exchange positions outside Liftx ownership.

## New lifecycle, same running strategy

For canonical Pine commands, use these identities consistently:

| Field | Lifetime |
| - | - |
| `source_instance_id` | Fixed for the setup; one ordered producer |
| `binding_revision` | Fixed setup revision |
| `client_command_id` | Unique per intent; unchanged for an identical delivery retry |
| `sequence` | Positive increasing event ordering within this producer |
| `client_position_id` | Fresh for each new position lifecycle; reused only for that lifecycle's modify/terminate |
| `position_started_at` | Immutable positive Unix-second start for that lifecycle; no later than issuance |

A cycle can be:

```text theme={null}
OPEN       reference source:cycle-A  sequence 101
MODIFY     reference source:cycle-A  sequence 102
TERMINATE  reference source:cycle-A  sequence 103

After prior lifecycle completion is established:
OPEN       reference source:cycle-B  sequence 104
TERMINATE  reference source:cycle-B  sequence 105
```

The key remains the same. Cycle B uses a new reference and start time. No Liftx position UUID is required in the Pine signal; `position_id` is not accepted as a TradingView target.

Do not reuse a lifecycle reference to reopen a position. Termination fences that reference against further trading signals, including while termination is still pending. A delayed message for cycle A cannot select cycle B by sharing a market name.

## Group termination captures a finite set

Group admission saves the original intent and its selected targets together. Each child follows the normal position-termination path and has its own receipt.

* At most **64 targets** are captured in one group.
* A group exceeding this bound or available queue capacity fails as a whole; it is not silently truncated.
* An identical retry refers to the same captured set, not a newly expanded list.
* Zero matching targets is a valid accepted result and can still advance the source's ordering fence.
* Positions opened after capture are outside the group. The command is not a permanent market pause.
* Child outcomes can differ; inspect **View targets** in Activity. Group admission is not atomic exchange execution.

A strategy group selects eligible own references earlier than its sequence. A market group must be newer than its own source's watermark; independent strategies have independent sequence spaces, so their sequence numbers are not compared as one global clock.

## Late OPEN protection

Each source maintains a durable fence for unseen OPEN messages. Admitted OPEN and termination signals advance it, including a termination group with no targets. An unseen older OPEN cannot arrive later and reopen work behind that fence.

An exact close for a known older position can still follow a newer position's open, subject to that lifecycle's own ordering. This allows multiple-position strategies to close one older cycle without pretending all cycles share a position reference.

Ordering is not a request to replay missed commands. Sequence gaps do not cause Liftx to synthesize trades.

## Single and multiple opening policies

**One position at a time** checks known active canonical positions, resident candidates and pending or uncertain work owned by this setup. If evidence is incomplete, admission fails rather than assuming it is safe. The check is not an exchange-wide guarantee against another strategy, a later fill or later reactivation.

**Multiple concurrent positions** permits distinct lifecycles. The quantity cap applies independently to each, so ten positions each below the cap can have ten times one position's quantity. An external risk controller is needed for a portfolio-wide budget.

An emitted EXIT does not clear either policy. A subsequent OPEN can still be rejected until the earlier lifecycle is complete. Pine has no callback that proves readiness and does not automatically queue a rejected entry.

## Ownership scenarios

| Setup | Normal strategy exit can affect | Normal strategy exit cannot affect |
| - | - | - |
| BTC trend key | BTC positions opened by that setup on its fixed link | ETH, manual BTC or BTC mean-reversion setup |
| ETH trend key | ETH positions opened by that setup on its fixed link | BTC or another ETH setup |
| BTC market-exit key with explicit grant | Captured matching BTC Liftx positions on its fixed link when it selects `market` | Other links, ETH, future opens or unmanaged exchange positions |

A new exit-only setup owns no positions initially. Selecting `strategy` will not discover positions opened by another key's independent setup. Credential rotation within the same integration retains the namespace; a new integration does not inherit it.

## Cancel versus close

Canonical TradingView commands accept `terminate`, and normalize `cancel` and `close` to the same termination operation. Ordinary JSON uses `terminate` only.

Termination cancels pending work and closes remaining exposure. A pending position may need only cancellation; a partially filled position may also need closure. `cancel` does not promise to keep existing exposure. For a targeted OPEN-row amendment without terminating the position, use the [direct API modification contract](/api/modify-positions) with current state.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.