strategy - Pine Script Constants
strategy
Section titled “strategy”Overview
Section titled “Overview”Constants under the strategy namespace.
Constants
Section titled “Constants”| Name | Type | Description |
|---|---|---|
strategy.cash | const string | This 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_contract | const string | Commission type for an order. Money displayed in the account currency per contract. |
strategy.commission.cash_per_order | const string | Commission type for an order. Money displayed in the account currency per order. |
strategy.commission.percent | const string | Commission type for an order. A percentage of the cash volume of order. |
strategy.direction.all | const string | It allows strategy to open both long and short positions. |
strategy.direction.long | const string | It allows strategy to open only long positions. |
strategy.direction.short | const string | It allows strategy to open only short positions. |
strategy.fixed | const string | This 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.long | const strategy_direction | A 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.cancel | const string | A 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.none | const string | A 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.reduce | const string | A 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_equity | const string | This 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.short | const strategy_direction | A 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. |
Remarks
Section titled “Remarks”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.