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

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

# RelativeTakeProfitProtections constructor

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

## RelativeTakeProfitProtections(RelativeTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with only a final take profit.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtections(RelativeTakeProfitLastProtection lastTakeProfit)
```

Python:

```python
RelativeTakeProfitProtections(lastTakeProfit: RelativeTakeProfitLastProtection)
```

### Parameters

- `lastTakeProfit` (`RelativeTakeProfitLastProtection`, Python `RelativeTakeProfitLastProtection`): The final take profit that closes the remaining volume.

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
```

Python:

```python
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
```

## RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with one partial take profit and a final take profit.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
```

Python:

```python
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
```

### Parameters

- `firstTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The first partial take profit.
- `lastTakeProfit` (`RelativeTakeProfitLastProtection`, Python `RelativeTakeProfitLastProtection`): The final take profit that closes the remaining volume.

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(10000, 20), new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 20000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
```

Python:

```python
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(10000, 20), RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 20000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
```

## RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with two partial take profits and a final take profit.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
```

Python:

```python
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, secondTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
```

### Parameters

- `firstTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The first partial take profit.
- `secondTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The second partial take profit.
- `lastTakeProfit` (`RelativeTakeProfitLastProtection`, Python `RelativeTakeProfitLastProtection`): The final take profit that closes the remaining volume.

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(10000, 20), new RelativeTakeProfitProtection(10000, 30), new RelativeTakeProfitLastProtection(45));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 30000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
```

Python:

```python
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(10000, 20), RelativeTakeProfitProtection(10000, 30), RelativeTakeProfitLastProtection(45))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 30000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
```

## RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with three partial take profits and a final take profit.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
```

Python:

```python
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, secondTakeProfit: RelativeTakeProfitProtection, thirdTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
```

### Parameters

- `firstTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The first partial take profit.
- `secondTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The second partial take profit.
- `thirdTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The third partial take profit.
- `lastTakeProfit` (`RelativeTakeProfitLastProtection`, Python `RelativeTakeProfitLastProtection`): The final take profit that closes the remaining volume.

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var takeProfits = new RelativeTakeProfitProtections(
    new RelativeTakeProfitProtection(10000, 15),
    new RelativeTakeProfitProtection(10000, 25),
    new RelativeTakeProfitProtection(10000, 35),
    new RelativeTakeProfitLastProtection(50));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 40000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
```

Python:

```python
takeProfits = RelativeTakeProfitProtections(
    RelativeTakeProfitProtection(10000, 15),
    RelativeTakeProfitProtection(10000, 25),
    RelativeTakeProfitProtection(10000, 35),
    RelativeTakeProfitLastProtection(50))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 40000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
```

## RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitProtection fourthTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)

Initializes a new instance with four partial take profits and a final take profit.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtections(RelativeTakeProfitProtection firstTakeProfit, RelativeTakeProfitProtection secondTakeProfit, RelativeTakeProfitProtection thirdTakeProfit, RelativeTakeProfitProtection fourthTakeProfit, RelativeTakeProfitLastProtection lastTakeProfit)
```

Python:

```python
RelativeTakeProfitProtections(firstTakeProfit: RelativeTakeProfitProtection, secondTakeProfit: RelativeTakeProfitProtection, thirdTakeProfit: RelativeTakeProfitProtection, fourthTakeProfit: RelativeTakeProfitProtection, lastTakeProfit: RelativeTakeProfitLastProtection)
```

### Parameters

- `firstTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The first partial take profit.
- `secondTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The second partial take profit.
- `thirdTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The third partial take profit.
- `fourthTakeProfit` (`RelativeTakeProfitProtection`, Python `RelativeTakeProfitProtection`): The fourth partial take profit.
- `lastTakeProfit` (`RelativeTakeProfitLastProtection`, Python `RelativeTakeProfitLastProtection`): The final take profit that closes the remaining volume.

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var takeProfits = new RelativeTakeProfitProtections(
    new RelativeTakeProfitProtection(10000, 10),
    new RelativeTakeProfitProtection(10000, 20),
    new RelativeTakeProfitProtection(10000, 30),
    new RelativeTakeProfitProtection(10000, 40),
    new RelativeTakeProfitLastProtection(60));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 50000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Order executed: {0}", result.IsSuccessful);
```

Python:

```python
takeProfits = RelativeTakeProfitProtections(
    RelativeTakeProfitProtection(10000, 10),
    RelativeTakeProfitProtection(10000, 20),
    RelativeTakeProfitProtection(10000, 30),
    RelativeTakeProfitProtection(10000, 40),
    RelativeTakeProfitLastProtection(60))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 50000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Order executed: {result.IsSuccessful}")
```

## RelativeTakeProfitProtections(RelativeTakeProfitProtections original)



Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public RelativeTakeProfitProtections(RelativeTakeProfitProtections original)
```

Python:

```python
RelativeTakeProfitProtections(original: RelativeTakeProfitProtections)
```

### Parameters

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

Available since cAlgo.API 5.8.

