---
id: "T:cAlgo.API.PendingOrder"
kind: "interface"
namespace: "cAlgo.API"
url: "https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/"
---

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

# PendingOrder (interface)

Provides access to properties of pending orders

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public interface PendingOrder
```

## Examples

C#:

```csharp
var limitPrice = Symbol.Bid - 20 * Symbol.PipSize;
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, Symbol.QuantityToVolumeInUnits(0.01), limitPrice, "myLabel", 20, 40, ProtectionType.Relative);
if (result.IsSuccessful)
{
    var order = result.PendingOrder;
    Print("Order {0}: {1} {2} {3} at {4}", order.Id, order.OrderType, order.TradeType, order.VolumeInUnits, order.TargetPrice);
}
else
{
    Print("Order placement failed: {0}", result.Error);
}
```

Python:

```python
limitPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, api.Symbol.QuantityToVolumeInUnits(0.01), limitPrice, "myLabel", 20, 40, ProtectionType.Relative)
if result.IsSuccessful:
    order = result.PendingOrder
    api.Print(f"Order {order.Id}: {order.OrderType} {order.TradeType} {order.VolumeInUnits} at {order.TargetPrice}")
else:
    api.Print(f"Order placement failed: {result.Error}")
```

C#:

```csharp
foreach (var order in PendingOrders.Where(pendingOrder => pendingOrder.Label == "myLabel").ToArray())
{
    if (order.DistancePips > 50)
        order.Cancel();
    else
        order.ModifyStopLossPips(15);
}
```

Python:

```python
for order in [pendingOrder for pendingOrder in api.PendingOrders if pendingOrder.Label == "myLabel"]:
    if order.DistancePips > 50:
        order.Cancel()
    else:
        order.ModifyStopLossPips(15)
```

C#:

```csharp
protected override void OnStart()
{
    PendingOrders.Filled += OnPendingOrdersFilled;
    PendingOrders.Cancelled += OnPendingOrdersCancelled;
}

private void OnPendingOrdersFilled(PendingOrderFilledEventArgs args)
{
    Print("Order {0} filled, position {1} opened", args.PendingOrder.Id, args.Position.Id);
}

private void OnPendingOrdersCancelled(PendingOrderCancelledEventArgs args)
{
    Print("Order {0} cancelled, reason: {1}", args.PendingOrder.Id, args.Reason);
}
```

Python:

```python
def on_start(self):
    api.PendingOrders.Filled += self.on_pending_orders_filled
    api.PendingOrders.Cancelled += self.on_pending_orders_cancelled

def on_pending_orders_filled(self, args):
    api.Print(f"Order {args.PendingOrder.Id} filled, position {args.Position.Id} opened")

def on_pending_orders_cancelled(self, args):
    api.Print(f"Order {args.PendingOrder.Id} cancelled, reason: {args.Reason}")
```

## Methods

- `TradeResult Cancel()` — Shortcut for Robot.CancelPendingOrder method [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Cancel/index.md)
- `TradeResult ModifyExpirationTime(DateTime? expirationTime)` — Shortcut for Robot.ModifyPendingOrder method to change Expiration Time [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyExpirationTime/index.md)
- `TradeResult ModifyStopLimitRange(double stopLimitRangePips)` — Shortcut for Robot.ModifyPendingOrder method to change Stop Limit Range [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyStopLimitRange/index.md)
- `TradeResult ModifyStopLossBreakEven(StopLossBreakEven stopLossBreakEven)` — Shortcut for the Robot.ModifyPosition method to change the StopLoss Break-Even. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyStopLossBreakEven/index.md)
- `TradeResult ModifyStopLossPips(double? stopLossPips)` — Shortcut for Robot.ModifyPendingOrder method to change Stop Loss [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyStopLossPips/index.md)
- `TradeResult ModifyStopLossPrice(double? stopLoss)` — Shortcut for Robot.ModifyPendingOrder method to change Stop Loss [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyStopLossPrice/index.md)
- `TradeResult ModifyTakeProfit(RelativeTakeProfitProtections takeProfitProtections)` — Shortcut for the Robot.ModifyTakeProfit method to change the Take Profit protection [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyTakeProfit/index.md)
- `TradeResult ModifyTakeProfit(AbsoluteTakeProfitProtections takeProfitProtections)` — Shortcut for the Robot.ModifyTakeProfit method to change the Take Profit protection [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyTakeProfit/index.md)
- `TradeResult ModifyTakeProfitPips(double? takeProfitPips)` — Shortcut for Robot.ModifyPendingOrder method to change Take Profit [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyTakeProfitPips/index.md)
- `TradeResult ModifyTakeProfitPrice(double? takeProfit)` — Shortcut for Robot.ModifyPendingOrder method to change Take Profit [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyTakeProfitPrice/index.md)
- `TradeResult ModifyTargetPrice(double targetPrice)` — Shortcut for Robot.ModifyPendingOrder method to change Target Price [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyTargetPrice/index.md)
- `TradeResult ModifyVolume(double volume)` — Shortcut for Robot.ModifyPendingOrder method to change VolumeInUnits [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ModifyVolume/index.md)

## Properties

- `AbsoluteTakeProfitProtections AbsoluteTakeProfitProtections {get;}` — The absolute take profit protections of the order. Null if order has no take profit. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/AbsoluteTakeProfitProtections/index.md)
- `string Channel {get;}` — Gets the channel via which the order was placed in a string format. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Channel/index.md)
- `string Comment {get;}` — User assigned Order Comment [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Comment/index.md)
- `double CurrentPrice {get;}` — Gets the current price of the symbol for which the pending order is placed. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/CurrentPrice/index.md)
- `double DistancePips {get;}` — Gets the distance in pips between the current price of the symbol and the target price of the pending order (via TargetPrice ). [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/DistancePips/index.md)
- `DateTime? ExpirationTime {get;}` — The order Expiration time The Timezone used is set in the Robot attribute [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ExpirationTime/index.md)
- `bool HasTrailingStop {get;}` — When HasTrailingStop set to true, server updates Stop Loss every time position moves in your favor. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/HasTrailingStop/index.md)
- `int Id {get;}` — Unique order Id. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Id/index.md)
- `string Label {get;}` — User assigned identifier for the order. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Label/index.md)
- `DateTime? LastUpdateTime {get;}` — Gets the time when an order was last updated. The timezone used is set in the algorithm class attribute. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/LastUpdateTime/index.md)
- `PendingOrderType OrderType {get;}` — Specifies whether this order is Stop or Limit. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/OrderType/index.md)
- `ProtectionType ProtectionType {get;}` — Gets the order protection type. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/ProtectionType/index.md)
- `double Quantity {get;}` — Quantity (lots) of this order [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Quantity/index.md)
- `RelativeTakeProfitProtections RelativeTakeProfitProtections {get;}` — The relative take profit protections of the order. Null if order has no take profit. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/RelativeTakeProfitProtections/index.md)
- `double? StopLimitRangePips {get;}` — Maximum limit from order target price, where order can be executed. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/StopLimitRangePips/index.md)
- `double? StopLoss {get;}` — The order stop loss in price [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/StopLoss/index.md)
- `StopLossBreakEven StopLossBreakEven {get;}` — The stop loss break even of the order. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/StopLossBreakEven/index.md)
- `double? StopLossPips {get;}` — The order stop loss in pips [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/StopLossPips/index.md)
- `StopTriggerMethod? StopLossTriggerMethod {get;}` — Trigger method for order's StopLoss [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/StopLossTriggerMethod/index.md)
- `StopTriggerMethod? StopOrderTriggerMethod {get;}` — Determines how pending order will be triggered in case it is a StopOrder [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/StopOrderTriggerMethod/index.md)
- `DateTime SubmittedTime {get;}` — Gets the order submission time. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/SubmittedTime/index.md)
- `Symbol Symbol {get;}` — Gets the order symbol. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/Symbol/index.md)
- `string SymbolName {get;}` — Gets the symbol name. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/SymbolName/index.md)
- `double? TakeProfit {get;}` — The order take profit in price [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/TakeProfit/index.md)
- `double? TakeProfitPips {get;}` — The order take profit in pips [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/TakeProfitPips/index.md)
- `double TargetPrice {get;}` — The order target price. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/TargetPrice/index.md)
- `TradeType TradeType {get;}` — Specifies whether this order is to buy or sell. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/TradeType/index.md)
- `double VolumeInUnits {get;}` — Volume of this order. [details](https://help.ctrader.com/ctrader-algo/references/Trading/Orders/PendingOrder/VolumeInUnits/index.md)

## Deprecated members

- `string SymbolCode {get;}` — Use SymbolName instead
- `long Volume {get;}` — Use VolumeInUnits instead

