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

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

# Position.ModifyTrailingStop

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

## ModifyTrailingStop(bool hasTrailingStop)

Shortcut for the Robot.ModifyPosition method to change the Trailing Stop.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
TradeResult ModifyTrailingStop(bool hasTrailingStop)
```

Python:

```python
position.ModifyTrailingStop(hasTrailingStop: bool) -> TradeResult
```

### Parameters

- `hasTrailingStop` (`bool`, Python `bool`): If true position will have trailing stop loss

### Returns

`TradeResult` — 

### Examples

C#:

```csharp
var position = Positions.Find("myLabel");
if (position != null && position.StopLoss.HasValue)
{
    var result = position.ModifyTrailingStop(true);
    Print("Trailing stop enabled: {0}", result.IsSuccessful);
}
```

Python:

```python
position = api.Positions.Find("myLabel")
if position is not None and position.StopLoss is not None:
    result = position.ModifyTrailingStop(True)
    api.Print(f"Trailing stop enabled: {result.IsSuccessful}")
```

