---
id: "M:cAlgo.API.Indicator.ModifyPendingOrderAsync(cAlgo.API.PendingOrder,System.Double,System.Action{cAlgo.API.TradeResult})"
kind: "method"
type: "T:cAlgo.API.Indicator"
url: "https://help.ctrader.com/ctrader-algo/references/General/Indicator/ModifyPendingOrderAsync/"
---

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

# Indicator.ModifyPendingOrderAsync

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

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, long volume, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, long volume, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, volume: int, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`long`, Python `int`): New volume in units for the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), 10000, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), 10000, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: int, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`long`, Python `int`): New volume in units for the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: int, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`long`, Python `int`): New volume in units for the order
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: int, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`long`, Python `int`): New volume in units for the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, long volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: int, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`long`, Python `int`): New volume in units for the order
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, volume: float, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), 10000, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), 10000, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), 10000, true, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), 10000, True, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, double? stopLoss, double? takeProfit, ProtectionType? protectionType, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: float | None, takeProfit: float | None, protectionType: ProtectionType | None, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLimitRangePips: float | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`double?`, Python `float | None`): New Stop loss
- `takeProfit` (`double?`, Python `float | None`): New Take profit
- `protectionType` (`ProtectionType?`, Python `ProtectionType | None`): New Protection type
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLimitRangePips` (`double?`, Python `float | None`): Maximum distance for order execution from target price
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.1.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, 10, 20, ProtectionType.Relative, Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, 10, 20, ProtectionType.Relative, api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLimitRangePips: float | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLimitRangePips` (`double?`, Python `float | None`): Maximum distance for order execution from target price
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLimitRangePips: float | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`RelativeStopLossProtection`, Python `RelativeStopLossProtection`): Relative Stop loss
- `takeProfits` (`RelativeTakeProfitProtections`, Python `RelativeTakeProfitProtections`): Relative Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLimitRangePips` (`double?`, Python `float | None`): Maximum distance for order execution from target price
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLimitRangePips: float | None, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLimitRangePips` (`double?`, Python `float | None`): Maximum distance for order execution from target price
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

## ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Modify a Pending Order in asynchronous execution mode

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public TradeOperation ModifyPendingOrderAsync(PendingOrder pendingOrder, double targetPrice, AbsoluteStopLossProtection stopLoss, AbsoluteTakeProfitProtections takeProfits, DateTime? expirationTime, double volume, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopTriggerMethod? stopOrderTriggerMethod, double? stopLimitRangePips, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
```

Python:

```python
api.ModifyPendingOrderAsync(pendingOrder: PendingOrder, targetPrice: float, stopLoss: AbsoluteStopLossProtection, takeProfits: AbsoluteTakeProfitProtections, expirationTime: DateTime | None, volume: float, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopOrderTriggerMethod: StopTriggerMethod | None, stopLimitRangePips: float | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation
```

### Parameters

- `pendingOrder` (`PendingOrder`, Python `PendingOrder`): Pending Order to modify
- `targetPrice` (`double`, Python `float`): New target price at which the order becomes market order
- `stopLoss` (`AbsoluteStopLossProtection`, Python `AbsoluteStopLossProtection`): Absolute Stop loss
- `takeProfits` (`AbsoluteTakeProfitProtections`, Python `AbsoluteTakeProfitProtections`): Absolute Take profits
- `expirationTime` (`DateTime?`, Python `DateTime | None`): New expiry date and time
- `volume` (`double`, Python `float`): New volume in units for the order
- `hasTrailingStop` (`bool`, Python `bool`): Enable/disable TrailingStop for position
- `stopLossTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Trigger method for position's StopLoss
- `stopOrderTriggerMethod` (`StopTriggerMethod?`, Python `StopTriggerMethod | None`): Determines how pending order will be triggered in case it is a StopOrder
- `stopLimitRangePips` (`double?`, Python `float | None`): Maximum distance for order execution from target price
- `stopLossBreakEven` (`StopLossBreakEven`, Python `StopLossBreakEven`): Break-even for position's StopLoss
- `callback` (`Action<TradeResult>`, Python `Callable[[TradeResult], None]`): Method that is called when order is modified

### Returns

`TradeOperation` — Trade Operation

Available since cAlgo.API 5.8.

### Examples

C#:

```csharp
ModifyPendingOrderAsync(PendingOrders[0], Symbol.Ask, new AbsoluteStopLossProtection(1.0), new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(1000, 1.05), new AbsoluteTakeProfitProtection(2000, 1.06), new AbsoluteTakeProfitLastProtection(1.07)), Server.Time.AddDays(1), 10000, true, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, new StopLossBreakEven(15, 3), result => Print("Trade operation successful: {0}", result.IsSuccessful));
```

Python:

```python
api.ModifyPendingOrderAsync(api.PendingOrders[0], api.Symbol.Ask, AbsoluteStopLossProtection(1.0), AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(1000, 1.05), AbsoluteTakeProfitProtection(2000, 1.06), AbsoluteTakeProfitLastProtection(1.07)), api.Server.Time.AddDays(1), 10000, True, StopTriggerMethod.Trade, StopTriggerMethod.Trade, 5, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade operation successful: {result.IsSuccessful}"))
```

