Skip to main content
The Position Executor places one entry order and, once it fills, watches the position and closes it at the first exit that triggers: take profit, stop loss, trailing stop or time limit. This set of exits is called the triple barrier.

Overview

Create one from Condor

Agents and the Condor chat use the create_position_executor tool:
This opens a 0.01 BTC long at 5x leverage with a 2% stop loss, a 3% take profit and a one-hour time limit. In an agent session, controller_id must be the session ID (see Session IDs).
amount is in the base asset. For BTC-USDT, amount=0.01 is 0.01 BTC, not $0.01 or $100. To size in USD, divide the USD value by the price.

Parameters

The entry order

The entry is a LIMIT order by default, even when you leave out entry_price: For an immediate market entry, pass open_order_type=1.

Exits

Stop loss, take profit and trailing stop are checked once the entry has filled, and are measured on the position’s net P&L, after fees, as a fraction of the entry value. The first exit to trigger closes the position with a market order.

Take profit

With the default take_profit_order_type=1, the executor closes at market once the net profit reaches take_profit. For a long entered at $100 with `take_profit=0.02`, that is a little above $102, because fees count against the profit. With take_profit_order_type set to 2 or 3, the executor instead rests a limit order at entry price × (1 + take_profit) for a long, or entry price × (1 − take_profit) for a short, as soon as the entry fills.

Stop loss

The executor closes at market once the net loss reaches stop_loss. For a long entered at $100 with `stop_loss=0.01`, that is a little above $99, because fees count against the position.

Time limit

The executor closes at market once time_limit seconds have passed since it was created, whether or not the entry has filled. If the time limit has already passed when the executor starts, it ends at once with close type EXPIRED.

Trailing stop

A trailing stop locks in profit once the position is up by trailing_stop_activation_price:
  1. When the net profit first rises above the activation level, the executor sets a trigger at that profit minus trailing_stop_trailing_delta.
  2. As the profit grows, the trigger rises with it, always trailing_stop_trailing_delta behind the best profit seen.
  3. When the profit falls below the trigger, the executor closes at market.
Both values are profit fractions, not prices. Ignoring fees, for a long entered at $100 with trailing_stop_activation_price=0.01 and trailing_stop_trailing_delta=0.005:

Via the API

Create the executor with POST /executors/. Order types are numbers (1 MARKET, 2 LIMIT, 3 LIMIT_MAKER) and side is 1 or 2.
The API also accepts activation_bounds, which the Condor tool doesn’t expose: a list of fractions that keeps a limit entry order on the book only while it is close enough to the mid price.

Close types

Stopping early

Stop the executor with stop_executor or POST /executors/{executor_id}/stop:
  • keep_position=false (the default) cancels the open orders and closes the filled amount at market.
  • keep_position=true cancels the open orders and leaves the position open. The fills go to the Position Hold for this executor’s controller_id. See Position Handover.

Learn more