> This page is for TWS API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://interactivebrokers.com/docs/llms.txt.

# Market On Close

A Market On Close (MOC) order is a market order that is submitted to execute as close to the closing price as possible.

More on [Market On Close Orders](https://www.interactivebrokers.com/en/index.php?f=599)

More on [Supported exchanges](https://www.interactivebrokers.com/en/index.php?f=3883?ot=moc)

#### Python

```python
order = Order()
order.action = action
order.orderType = "MOC"
order.totalQuantity = quantity
```

#### Python

```python
order = Order()
order.action = action
order.orderType = "MOC"
order.totalQuantity = quantity
```

#### C++

```cpp
Order order;
order.action = action;
order.orderType = "MOC";
order.totalQuantity = quantity;
```

#### C\#

```csharp
Order order = new Order();
order.Action = action;
order.OrderType = "MOC";
order.TotalQuantity = quantity;
```

#### VB.NET

```vbnet
Dim order As Order = New Order
order.Action = action
order.OrderType = "MOC"
order.TotalQuantity = quantity
```