---
id: "M:cAlgo.API.Position.ModifyTakeProfitPrice(System.Nullable{System.Double})"
kind: "method"
type: "T:cAlgo.API.Position"
url: "https://help.ctrader.com/ctrader-algo/references/Trading/Positions/Position/ModifyTakeProfitPrice/"
---

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

# Position.ModifyTakeProfitPrice

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

## ModifyTakeProfitPrice(double? takeProfit)

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

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
TradeResult ModifyTakeProfitPrice(double? takeProfit)
```

Python:

```python
position.ModifyTakeProfitPrice(takeProfit: float | None) -> TradeResult
```

### Parameters

- `takeProfit` (`double?`, Python `float | None`): New Take Profit price

### Returns

`TradeResult` — 

### Examples

C#:

```csharp
var position = Positions.Find("myLabel");
if (position != null)
{
    var distance = 40 * position.Symbol.PipSize;
    var takeProfitPrice = position.TradeType == TradeType.Buy ? position.EntryPrice + distance : position.EntryPrice - distance;
    var result = position.ModifyTakeProfitPrice(takeProfitPrice);
    Print("Take profit modified: {0}", result.IsSuccessful);
}
```

Python:

```python
position = api.Positions.Find("myLabel")
if position is not None:
    distance = 40 * position.Symbol.PipSize
    takeProfitPrice = position.EntryPrice + distance if position.TradeType == TradeType.Buy else position.EntryPrice - distance
    result = position.ModifyTakeProfitPrice(takeProfitPrice)
    api.Print(f"Take profit modified: {result.IsSuccessful}")
```

