Skip to content
Algo Trade Analytics Docs

strategy - Pine Script Constants

Constants under the strategy namespace.

NameTypeDescription
strategy.cashconst stringThis is one of the arguments that can be supplied to the default_qty_type parameter in the strategy declaration statement. It is only relevant when no value is used for the ‘qty’ parameter in strategy.entry or strategy.order function calls. It specifies that an amount of cash in the strategy.account_currency will be used to enter trades.
strategy.commission.cash_per_contractconst stringCommission type for an order. Money displayed in the account currency per contract.
strategy.commission.cash_per_orderconst stringCommission type for an order. Money displayed in the account currency per order.
strategy.commission.percentconst stringCommission type for an order. A percentage of the cash volume of order.
strategy.direction.allconst stringIt allows strategy to open both long and short positions.
strategy.direction.longconst stringIt allows strategy to open only long positions.
strategy.direction.shortconst stringIt allows strategy to open only short positions.
strategy.fixedconst stringThis is one of the arguments that can be supplied to the default_qty_type parameter in the strategy declaration statement. It is only relevant when no value is used for the ‘qty’ parameter in strategy.entry or strategy.order function calls. It specifies that a number of contracts/shares/lots will be used to enter trades.
strategy.longconst strategy_directionA named constant for use with the direction parameter of the strategy.entry and strategy.order commands. It specifies that the command creates a buy order.
strategy.oca.cancelconst stringA named constant for use with the oca_type parameter of the strategy.entry and strategy.order commands. It specifies that the strategy cancels the unfilled order when another order with the same oca_name and oca_type executes.
strategy.oca.noneconst stringA named constant for use with the oca_type parameter of the strategy.entry and strategy.order commands. It specifies that the order executes independently of all other orders, including those with the same oca_name.
strategy.oca.reduceconst stringA named constant for use with the oca_type parameter of the strategy.entry and strategy.order commands. It specifies that when another order with the same oca_name and oca_type executes, the strategy reduces the unfilled order by that order’s size. If the unfilled order’s size reaches 0 after reduction, it is the same as canceling the order entirely.
strategy.percent_of_equityconst stringThis is one of the arguments that can be supplied to the default_qty_type parameter in the strategy declaration statement. It is only relevant when no value is used for the ‘qty’ parameter in strategy.entry or strategy.order function calls. It specifies that a percentage (0-100) of equity will be used to enter trades.
strategy.shortconst strategy_directionA named constant for use with the direction parameter of the strategy.entry and strategy.order commands. It specifies that the command creates a sell order.
  • strategy.oca.cancel: Strategies cannot cancel or reduce pending orders from an OCA group if they execute on the same tick. For example, if the market price triggers two stop orders from strategy.order calls with the same oca_* arguments, the strategy cannot fully or partially cancel either one.
  • strategy.oca.reduce: Strategies cannot cancel or reduce pending orders from an OCA group if they execute on the same tick. For example, if the market price triggers two stop orders from strategy.order calls with the same oca_* arguments, the strategy cannot fully or partially cancel either one.