Skip to main content

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 TypeDescription
LONGOpen a long position (buy)
SHORTOpen a short position (sell)

Closing Positions​

Position TypeDescription
CLOSEClose a specific position
CLOSE_PARTIALClose part of a position
CLOSE_ALLClose all positions for strategy
FLATAlias for CLOSE
CANCELAlias for CLOSE
CLOSE_LONGAlias for CLOSE
CLOSE_SHORTAlias for CLOSE

Position Management​

Position TypeDescription
MOVE_STOP_LOSSReplace the stop-loss and take-profit orders with the signal's prices
SET_ORDERSMOVE_STOP_LOSS after a delay (3 s by default)
CLOSE_LIMIT_ORDERAlias for MOVE_STOP_LOSS
CANCEL_ORDERSCancel the stop-loss and/or take-profit (cancel_stop_loss, cancel_take_profit)
UPDATE_ORDERReplace the position: close the open trade, then open a new one per action

Chase Orders​

Position TypeDescription
CHASE_LIMITChase limit orders on entry
CHASE_LIMIT_UPDATEUpdate chase settings

Advanced​

Position TypeDescription
CHANGE_DIRECTIONClose all open trades of the bot, then open the new position
VALIDATE_ALERTVerify position consistency
INTRA_ORDERConditional update/open
REFRESH_TRIGGER_STATERefresh 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​