Position Types Overview
The position_side parameter determines what action OptAlgo takes when processing your signal. The supported position types are organized into the categories below. position_side is case-sensitive: use upper case.
Quick Reference
Opening Positions
| Position Type | Description |
|---|---|
LONG | Open a long position (buy) |
SHORT | Open a short position (sell) |
Closing Positions
| Position Type | Description |
|---|---|
CLOSE | Close a specific position |
CLOSE_PARTIAL | Close part of a position |
CLOSE_ALL | Close all positions for strategy |
FLAT | Alias for CLOSE |
CANCEL | Alias for CLOSE |
CLOSE_LONG | Alias for CLOSE |
CLOSE_SHORT | Alias for CLOSE |
Position Management
| Position Type | Description |
|---|---|
MOVE_STOP_LOSS | Replace the stop-loss and take-profit orders with the signal's prices |
SET_ORDERS | MOVE_STOP_LOSS after a delay (3 s by default) |
CLOSE_LIMIT_ORDER | Alias for MOVE_STOP_LOSS |
CANCEL_ORDERS | Cancel the stop-loss and/or take-profit (cancel_stop_loss, cancel_take_profit) |
UPDATE_ORDER | Replace the position: close the open trade, then open a new one per action |
Chase Orders
| Position Type | Description |
|---|---|
CHASE_LIMIT | Chase limit orders on entry |
CHASE_LIMIT_UPDATE | Update chase settings |
Advanced
| Position Type | Description |
|---|---|
CHANGE_DIRECTION | Close all open trades of the bot, then open the new position |
VALIDATE_ALERT | Verify position consistency |
INTRA_ORDER | Conditional update/open |
REFRESH_TRIGGER_STATE | Refresh internal states |
Automatic Conversions
OptAlgo automatically converts some position types:
CLOSE_LIMIT_ORDER → MOVE_STOP_LOSS
SET_ORDERS → MOVE_STOP_LOSS (with 3s delay)
CHASE_LIMIT_UPDATE → CHASE_LIMIT (with QUEUE chase type)
FLAT/CANCEL/CLOSE_LONG/CLOSE_SHORT → CLOSE
CLOSE with close_ratio < 1 → CLOSE_PARTIAL
INTRA_ORDER (if no position) → UPDATE_ORDER
Next Steps
- Opening Positions - LONG and SHORT
- Closing Positions - All close variants
- Position Management - MOVE_STOP_LOSS, CANCEL_ORDERS, UPDATE_ORDER
- Chase Orders - CHASE_LIMIT orders
- Advanced Types - CHANGE_DIRECTION, VALIDATE_ALERT