> ## Documentation Index
> Fetch the complete documentation index at: https://gocharting.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# strategy constants

> Reference for the 9 constants of the strategy namespace: strategy.commission_cash_per_contract, strategy.commission_cash_per_order, strategy.commission_percent, strategy.fixed and 5 more, each with its definition and an example.

> [!NOTE]
>
> Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Namespace: strategy · Entries: 9

## `strategy.commission_cash_per_contract` (constant)

**Definition**

A commission type for the `commission_type` argument of `strategy()`: `commission_value` is an amount, in the account currency, charged per contract traded.

**Type**

`const string`

**Example**

> [!WARNING]
>
> GoCharting is a charting and analytics tool. This is not investment advice. Trading and investing carry a high risk of loss and are not suitable for everyone. You can lose some or all of your money.

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.commission_cash_per_contract Example", overlay=true, initial_capital=10000, commission_type=strategy.commission_cash_per_contract, commission_value=0.5)
if talib.crossover(close, talib.sma(close, 20)) {
    strategy.entry("Long", strategy.long)
}
```

## `strategy.commission_cash_per_order` (constant)

**Definition**

A commission type for the `commission_type` argument of `strategy()`: `commission_value` is a fixed amount, in the account currency, charged for each trade opened and for each trade closed. An order that closes several open trades, or part of one, is charged once for each trade it closes.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.commission_cash_per_order Example", overlay=true, initial_capital=10000, commission_type=strategy.commission_cash_per_order, commission_value=2)
if talib.crossover(close, talib.sma(close, 20)) {
    strategy.entry("Long", strategy.long)
}
```

## `strategy.commission_percent` (constant)

**Definition**

A commission type for the `commission_type` argument of `strategy()`: `commission_value` is a percentage of each order's value.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.commission_percent Example", overlay=true, initial_capital=10000, commission_type=strategy.commission_percent, commission_value=0.1)
if talib.crossover(close, talib.sma(close, 20)) {
    strategy.entry("Long", strategy.long)
}
```

## `strategy.fixed` (constant)

**Definition**

A position-size type for the `default_qty_type` argument of `strategy()`: `default_qty_value` is a fixed number of contracts, shares or units per order.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.fixed Example", overlay=true, initial_capital=10000, default_qty_type=strategy.fixed, default_qty_value=10)
if talib.crossover(close, talib.sma(close, 20)) {
    strategy.entry("Long", strategy.long)
}
```

## `strategy.long` (constant)

**Definition**

The long direction, for the `direction` argument of `strategy.entry` and `strategy.order`: buy to open or add to a long position.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.long Example", overlay=true, initial_capital=10000)
if talib.crossover(close, talib.sma(close, 20)) {
    strategy.entry("Long", strategy.long)
}
```

## `strategy.oca_cancel` (constant)

**Definition**

A one-cancels-all type, for the `oca_type` argument of `strategy.entry` and `strategy.order`. When one order of the group fills, the other orders of the same group are cancelled.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.oca_cancel Example", overlay=true, initial_capital=10000)
// Two breakout entries in one group: the first to fill decides
if strategy.position_size == 0 {
    strategy.entry("Up", strategy.long, stop=high + syminfo.mintick, oca_name="Breakout", oca_type=strategy.oca_cancel)
    strategy.entry("Down", strategy.short, stop=low - syminfo.mintick, oca_name="Breakout", oca_type=strategy.oca_cancel)
}
```

## `strategy.oca_none` (constant)

**Definition**

A one-cancels-all type, for the `oca_type` argument of `strategy.entry` and `strategy.order`. The order is not part of a one-cancels-all group; it is filled independently of other orders.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.oca_none Example", overlay=true, initial_capital=10000)
// Two breakout entries in one group: the first to fill decides
if strategy.position_size == 0 {
    strategy.entry("Up", strategy.long, stop=high + syminfo.mintick, oca_name="Breakout", oca_type=strategy.oca_none)
    strategy.entry("Down", strategy.short, stop=low - syminfo.mintick, oca_name="Breakout", oca_type=strategy.oca_none)
}
```

## `strategy.oca_reduce` (constant)

**Definition**

A one-cancels-all type, for the `oca_type` argument of `strategy.entry` and `strategy.order`. When one order of the group fills, the quantity of the other orders of the same group is reduced by the filled quantity.

**Type**

`const string`

**Example**

```lipi wrap theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.oca_reduce Example", overlay=true, initial_capital=10000)
// Two breakout entries in one group: the first to fill decides
if strategy.position_size == 0 {
    strategy.entry("Up", strategy.long, stop=high + syminfo.mintick, oca_name="Breakout", oca_type=strategy.oca_reduce)
    strategy.entry("Down", strategy.short, stop=low - syminfo.mintick, oca_name="Breakout", oca_type=strategy.oca_reduce)
}
```

## `strategy.short` (constant)

**Definition**

The short direction, for the `direction` argument of `strategy.entry` and `strategy.order`: sell to open or add to a short position.

**Type**

`const string`

**Example**

```lipi theme={"languages":{"custom":["/languages/lipi.json","/languages/lipi-invalid.json"]}}
//@lipi=2
strategy("strategy.short Example", overlay=true, initial_capital=10000)
if talib.crossunder(close, talib.sma(close, 20)) {
    strategy.entry("Short", strategy.short)
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.