---
id: "M:cAlgo.API.RelativeTakeProfitProtection.#ctor(System.Double,System.Double)"
kind: "constructor"
type: "T:cAlgo.API.RelativeTakeProfitProtection"
url: "https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/Constructor/"
---

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

# RelativeTakeProfitProtection constructor

Member of [RelativeTakeProfitProtection](https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/index.md).

## RelativeTakeProfitProtection(double Volume, double Distance)

Represents a partial take profit closing a portion of the order volume at a distance (in pips) from the entry price.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtection(double Volume, double Distance)
```

Python:

```python
RelativeTakeProfitProtection(Volume: float, Distance: float)
```

### Parameters

- `Volume` (`double`, Python `float`): The portion of the order volume to close when the take profit is triggered.
- `Distance` (`double`, Python `float`): The take profit distance, in pips, from the order's entry price.

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var firstTakeProfit = new RelativeTakeProfitProtection(10000, 20);
var takeProfits = new RelativeTakeProfitProtections(firstTakeProfit, new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 20000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Half of the position closes {0} pips from entry: {1}", firstTakeProfit.Distance, result.IsSuccessful);
```

Python:

```python
firstTakeProfit = RelativeTakeProfitProtection(10000, 20)
takeProfits = RelativeTakeProfitProtections(firstTakeProfit, RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 20000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Half of the position closes {firstTakeProfit.Distance} pips from entry: {result.IsSuccessful}")
```

## RelativeTakeProfitProtection(RelativeTakeProfitProtection original)



Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtection(RelativeTakeProfitProtection original)
```

Python:

```python
RelativeTakeProfitProtection(original: RelativeTakeProfitProtection)
```

### Parameters

- `original` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`):

Available since cAlgo.API 5.8.

