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

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

# Symbol.VolumeForFixedRisk

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

## VolumeForFixedRisk(double amount, double stopLossInPips)

Calculates the volume to be risked (in X units of the account deposit currency) 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 VolumeForFixedRisk(double amount, double stopLossInPips)
```

Python:

```python
api.Symbol.VolumeForFixedRisk(amount: float, stopLossInPips: float) -> float
```

### Parameters

- `amount` (`double`, Python `float`): The amount you want to risk in your account deposit currency.
- `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.VolumeForFixedRisk(1000, 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.VolumeForFixedRisk(1000, 20)
        api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, tradeVolume)
```

config.json:

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

## VolumeForFixedRisk(double amount, double stopLossInPips, RoundingMode roundingMode)

Calculates the volume to be risked (in X units of the account deposit currency) 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 VolumeForFixedRisk(double amount, double stopLossInPips, RoundingMode roundingMode)
```

Python:

```python
api.Symbol.VolumeForFixedRisk(amount: float, stopLossInPips: float, roundingMode: RoundingMode) -> float
```

### Parameters

- `amount` (`double`, Python `float`): The amount you want to risk in your account deposit currency.
- `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.VolumeForFixedRisk(1000, 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.VolumeForFixedRisk(1000, 20, RoundingMode.ToNearest)
        api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, tradeVolume)
```

config.json:

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

