Overview
| Property | Value |
|---|---|
| Position Type | Spot or Perp |
| keep_position | Configurable |
| Use Cases | Directional trades, scalping, swing trading |
How It Works
- Entry: Places order at
entry_price(or market if not specified) - Monitor: Once filled, continuously monitors price against barriers
- Exit: First barrier hit triggers position close
- Report: Reports P&L and terminates
Configuration
Triple Barrier Config
TheTripleBarrierConfig defines all exit conditions:
| Parameter | Type | Description |
|---|---|---|
take_profit | Decimal | Exit when profit reaches this % (e.g., 0.02 = 2%) |
stop_loss | Decimal | Exit when loss reaches this % (e.g., 0.01 = 1%) |
time_limit | int | Exit after this many seconds |
trailing_stop | TrailingStop | Dynamic stop that follows price |
open_order_type | OrderType | Entry order type (default: LIMIT) |
take_profit_order_type | OrderType | TP exit order type (default: MARKET) |
stop_loss_order_type | OrderType | SL exit order type (default: MARKET) |
time_limit_order_type | OrderType | Time exit order type (default: MARKET) |
Take Profit
Closes position when price moves in your favor by the specified percentage.Stop Loss
Closes position when price moves against you by the specified percentage.Time Limit
Closes position after a maximum duration, regardless of P&L.Trailing Stop
A dynamic stop loss that follows the price as it moves in your favor.- Position enters at $100
- Price rises to $101 (1% profit) → trailing stop activates
- Stop is placed at $100.50 (0.5% below current price)
- Price rises to 102.49
- Price drops to $102.49 → trailing stop triggers, position closes
Parameters
| Parameter | Type | Description |
|---|---|---|
connector_name | string | Exchange connector |
trading_pair | string | Market (e.g., “SOL-USDT”) |
side | TradeType | BUY (long) or SELL (short) |
amount | Decimal | Position size in base asset |
entry_price | Decimal | Entry price (None for market order) |
leverage | int | Leverage for perpetual markets |
triple_barrier_config | TripleBarrierConfig | Exit conditions |
activation_bounds | List[Decimal] | Optional price bounds to activate |
Order Types
You can configure which order type to use for each action:Example: Scalp Trade
Example: Swing Trade with Trailing Stop
Close Types
When the executor terminates, it reports which barrier was hit:| Close Type | Description |
|---|---|
TAKE_PROFIT | Price reached profit target |
STOP_LOSS | Price reached loss limit |
TIME_LIMIT | Maximum duration exceeded |
TRAILING_STOP | Trailing stop triggered |
EARLY_STOP | Manually stopped |
Position Handover
Ifkeep_position=true (set via early stop):
- Position remains open in the account
- Added to agent’s Position Hold for later management
keep_position=false (default for barrier exits):
- Position fully closed
- Realized P&L calculated and reported

