---
id: "M:cAlgo.API.PendingOrder.ModifyTakeProfit(cAlgo.API.RelativeTakeProfitProtections)"
kind: "method"
type: "T:cAlgo.API.PendingOrder"
url: "https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyTakeProfit/"
---

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

# PendingOrder.ModifyTakeProfit

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

## ModifyTakeProfit(RelativeTakeProfitProtections takeProfitProtections)

Shortcut for the Robot.ModifyTakeProfit method to change the Take Profit protection

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
TradeResult ModifyTakeProfit(RelativeTakeProfitProtections takeProfitProtections)
```

Python:

```python
pendingOrder.ModifyTakeProfit(takeProfitProtections: RelativeTakeProfitProtections) -> TradeResult
```

### Parameters

- `takeProfitProtections` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): New Take Profit protections

### Returns

`TradeResult` — 

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
foreach (var order in PendingOrders)
{
    var halfVolume = order.Symbol.NormalizeVolumeInUnits(order.VolumeInUnits / 2, RoundingMode.Down);
    var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(halfVolume, 20), new RelativeTakeProfitLastProtection(40));
    var result = order.ModifyTakeProfit(takeProfits);
    Print("Order {0} take profit ladder set: {1}", order.Id, result.IsSuccessful);
}
```

Python:

```python
for order in api.PendingOrders:
    halfVolume = order.Symbol.NormalizeVolumeInUnits(order.VolumeInUnits / 2, RoundingMode.Down)
    takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(halfVolume, 20), RelativeTakeProfitLastProtection(40))
    result = order.ModifyTakeProfit(takeProfits)
    api.Print(f"Order {order.Id} take profit ladder set: {result.IsSuccessful}")
```

## ModifyTakeProfit(AbsoluteTakeProfitProtections takeProfitProtections)

Shortcut for the Robot.ModifyTakeProfit method to change the Take Profit protection

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
TradeResult ModifyTakeProfit(AbsoluteTakeProfitProtections takeProfitProtections)
```

Python:

```python
pendingOrder.ModifyTakeProfit(takeProfitProtections: AbsoluteTakeProfitProtections) -> TradeResult
```

### Parameters

- `takeProfitProtections` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): New Take Profit protections

### Returns

`TradeResult` — 

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
foreach (var order in PendingOrders)
{
    var distance = 50 * order.Symbol.PipSize;
    var targetPrice = order.TradeType == TradeType.Buy ? order.TargetPrice + distance : order.TargetPrice - distance;
    var result = order.ModifyTakeProfit(new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitLastProtection(targetPrice)));
    Print("Order {0} take profit set at {1}: {2}", order.Id, targetPrice, result.IsSuccessful);
}
```

Python:

```python
for order in api.PendingOrders:
    distance = 50 * order.Symbol.PipSize
    targetPrice = order.TargetPrice + distance if order.TradeType == TradeType.Buy else order.TargetPrice - distance
    result = order.ModifyTakeProfit(AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection(targetPrice)))
    api.Print(f"Order {order.Id} take profit set at {targetPrice}: {result.IsSuccessful}")
```

