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

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

# Position.ModifyTakeProfit

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

## ModifyTakeProfit(RelativeTakeProfitProtections takeProfitProtections)

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

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

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

Python:

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

### Parameters

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

### Returns

`TradeResult` — 

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var position = Positions.Find("myLabel");
if (position != null)
{
    var halfVolume = position.Symbol.NormalizeVolumeInUnits(position.VolumeInUnits / 2, RoundingMode.Down);
    var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(halfVolume, 20), new RelativeTakeProfitLastProtection(40));
    var result = position.ModifyTakeProfit(takeProfits);
    Print("Take profit ladder set: {0}", result.IsSuccessful);
}
```

Python:

```python
position = api.Positions.Find("myLabel")
if position is not None:
    halfVolume = position.Symbol.NormalizeVolumeInUnits(position.VolumeInUnits / 2, RoundingMode.Down)
    takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(halfVolume, 20), RelativeTakeProfitLastProtection(40))
    result = position.ModifyTakeProfit(takeProfits)
    api.Print(f"Take profit ladder set: {result.IsSuccessful}")
```

## ModifyTakeProfit(AbsoluteTakeProfitProtections takeProfitProtections)

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

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

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

Python:

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

### Parameters

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

### Returns

`TradeResult` — 

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
var position = Positions.Find("myLabel");
if (position != null)
{
    var distance = 50 * position.Symbol.PipSize;
    var targetPrice = position.TradeType == TradeType.Buy ? position.EntryPrice + distance : position.EntryPrice - distance;
    var result = position.ModifyTakeProfit(new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitLastProtection(targetPrice)));
    Print("Take profit set at {0}: {1}", targetPrice, result.IsSuccessful);
}
```

Python:

```python
position = api.Positions.Find("myLabel")
if position is not None:
    distance = 50 * position.Symbol.PipSize
    targetPrice = position.EntryPrice + distance if position.TradeType == TradeType.Buy else position.EntryPrice - distance
    result = position.ModifyTakeProfit(AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection(targetPrice)))
    api.Print(f"Take profit set at {targetPrice}: {result.IsSuccessful}")
```

