---
id: "T:cAlgo.API.RelativeTakeProfitProtection"
kind: "record"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/"
---

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

# RelativeTakeProfitProtection (record)

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.

## Definition

```csharp
public class RelativeTakeProfitProtection
```

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}")
```

## Constructors

- `public 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. [details](https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/Constructor/index.md)
- `public RelativeTakeProfitProtection(RelativeTakeProfitProtection original)` —  [details](https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/Constructor/index.md)

## Properties

- `public double Distance {get; set;}` — The take profit distance, in pips, from the order's entry price. [details](https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/Distance/index.md)
- `public double Volume {get; set;}` — The portion of the order volume to close when the take profit is triggered. [details](https://help.ctrader.com/ctrader-algo/references/Trading/RelativeTakeProfitProtection/Volume/index.md)

