---
id: "M:cAlgo.API.Internals.Symbol.VolumeForProportionalRisk(cAlgo.API.ProportionalAmountType,System.Double,System.Double)"
kind: "method"
type: "T:cAlgo.API.Internals.Symbol"
url: "https://help.ctrader.com/ctrader-algo/references/MarketData/Symbols/Symbol/VolumeForProportionalRisk/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Symbol.VolumeForProportionalRisk

Member of [Symbol](https://help.ctrader.com/ctrader-algo/references/MarketData/Symbols/Symbol/index.md).

## VolumeForProportionalRisk(ProportionalAmountType type, double percentage, double stopLossInPips)

Calculates the volume to be risked (in X% of either the account equity or balance) based on the specified stop loss. Note that the result of this calculation may be imprecise as the exact degree of risk always depends on market movement and is impossible to predict.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
double VolumeForProportionalRisk(ProportionalAmountType type, double percentage, double stopLossInPips)
```

Python:

```python
api.Symbol.VolumeForProportionalRisk(type: ProportionalAmountType, percentage: float, stopLossInPips: float) -> float
```

### Parameters

- `type` (`ProportionalAmountType`, Python `ProportionalAmountType`): The type of the amount to be risked (either balance or equity).
- `percentage` (`double`, Python `float`): The percentage of equity or balance to be risked.
- `stopLossInPips` (`double`, Python `float`): The stop loss in pips.

### Returns

`double` — The calculated volume in units.

### Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
    protected override void OnStart()
    {
        var tradeVolume = Symbol.VolumeForProportionalRisk(ProportionalAmountType.Equity, 1, 20);

        ExecuteMarketOrder(TradeType.Buy, SymbolName, tradeVolume);
    }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        tradeVolume = api.Symbol.VolumeForProportionalRisk(ProportionalAmountType.Equity, 1, 20)
        api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, tradeVolume)
```

config.json:

```json
{
  "AccessRights": "None"
}
```

## VolumeForProportionalRisk(ProportionalAmountType type, double percentage, double stopLossInPips, RoundingMode roundingMode)

Calculates the volume to be risked (in X% of either the account equity or balance) based on the specified stop loss. Note that the result of this calculation may be imprecise as the exact degree of risk always depends on market movement and is impossible to predict.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
double VolumeForProportionalRisk(ProportionalAmountType type, double percentage, double stopLossInPips, RoundingMode roundingMode)
```

Python:

```python
api.Symbol.VolumeForProportionalRisk(type: ProportionalAmountType, percentage: float, stopLossInPips: float, roundingMode: RoundingMode) -> float
```

### Parameters

- `type` (`ProportionalAmountType`, Python `ProportionalAmountType`): The type of the amount to be risked (either balance or equity).
- `percentage` (`double`, Python `float`): The percentage of equity or balance to be risked.
- `stopLossInPips` (`double`, Python `float`): The stop loss in pips.
- `roundingMode` (`RoundingMode`, Python `RoundingMode`): The rounding method.

### Returns

`double` — The calculated volume in units

### Examples

C#:

```csharp
using cAlgo.API;

namespace cAlgo.Robots;

public partial class TestExample : Robot
{
    protected override void OnStart()
    {
        var tradeVolume = Symbol.VolumeForProportionalRisk(ProportionalAmountType.Equity, 1, 20, RoundingMode.ToNearest);

        ExecuteMarketOrder(TradeType.Buy, SymbolName, tradeVolume);
    }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class Test():
    def on_start(self):
        tradeVolume = api.Symbol.VolumeForProportionalRisk(ProportionalAmountType.Equity, 1, 20, RoundingMode.ToNearest)
        api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, tradeVolume)
```

config.json:

```json
{
  "AccessRights": "None"
}
```

