> For the complete documentation index, see [llms.txt](https://tradesync.gitbook.io/tradesync/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tradesync.gitbook.io/tradesync/fxtr-v2/functions-of-fxtr-v2/open-stream-for-the-account/messages-that-can-be-sent-in-open-stream/openorder.md).

# OpenOrder

**`OpenOrder`** - adding an open order to the server database.

Example:

`{"id": 11, "type":"OpenOrder", "body": {"symbol":"EURUSD.r", "type": 2, "price": 1.0,"volume": 0.01}}`

**Request Body Fields:**

<table><thead><tr><th>Parameter</th><th width="104" data-type="checkbox">Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>symbol</code> </td><td>true</td><td><code>string</code></td><td>the name of the symbol by which you need to get orders</td></tr><tr><td><code>type</code></td><td>true</td><td><code>int</code></td><td><p>the order type, can be: </p><ul><li>0 - BUY</li><li>1 - SELL</li><li>2 - BUY LIMIT</li><li>3 - SELL LIMIT</li><li>4 - BUY STOP</li><li>5 - SELL STOP</li><li>6 - BUY STOP LIMIT</li><li>7 - SELL STOP LIMIT</li></ul></td></tr><tr><td><code>price</code></td><td>false</td><td><code>double nullable</code></td><td>order price</td></tr><tr><td><code>price_trigger</code></td><td>false</td><td><code>double nullable</code></td><td>new price of triggering for stop limit orders</td></tr><tr><td><code>volume</code></td><td>true</td><td><code>double</code></td><td>the volume of a deal in lots</td></tr><tr><td><code>sl</code></td><td>false</td><td><code>double nullable</code></td><td>the Stop Loss level of a trade</td></tr><tr><td><code>tp</code></td><td>false</td><td><code>double nullable</code></td><td>the Take Profit level of a trade</td></tr><tr><td><code>max_lost</code> </td><td>false</td><td><code>double nullable</code></td><td>the amount in currency by which the <code>stop_loss</code> is estimated, limiting the loss on the trade to the specified amount</td></tr><tr><td><code>profit_factor</code></td><td>false</td><td><code>double nullable</code></td><td>this ratio <code>max_profit/max_lost</code> is used to calculate <code>take_profit</code> if <code>max_lost</code> is specified and <code>max_profit</code> is not specified.</td></tr><tr><td><code>max_profit</code></td><td>false</td><td><code>double nullable</code></td><td>the amount in the currency for which the <code>take_profit</code> is calculated, limiting the profit on the trade to the specified amount</td></tr><tr><td><code>deviation</code></td><td>false</td><td><code>int nullable</code></td><td>deviation in %</td></tr><tr><td><code>comment</code></td><td>false</td><td><code>string nullable</code></td><td>comment</td></tr><tr><td><code>time_out</code> </td><td>false</td><td><code>int64</code></td><td>time in milliseconds that should be wait for async requests results (it can be from 109 msec to 7 sec; if you set <code>time_out &#x3C;109 msec,</code> it will be 109 msec; if you set <code>time_out > 7 sec,</code> it will be 7 sec)</td></tr></tbody></table>

**Responce Type** - `OpenOrder.`

**Responce Body Fields:**

<table><thead><tr><th>Parameter</th><th width="166" data-type="checkbox">Always returned</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>result</code></td><td>true</td><td><code>int</code></td><td>result of operation Meta Trader server</td></tr><tr><td><code>ticket</code> </td><td>true</td><td><code>unsigned long long</code></td><td>the ticket of new opened order on Meta Trader Server</td></tr><tr><td><code>price</code></td><td>true</td><td><code>double</code></td><td>price of order execution, in case of pending, limit, stop orders price is 0</td></tr><tr><td><code>time</code></td><td>true</td><td><code>int64</code></td><td>time of order execution, in case of pending, limit, stop orders time is 0</td></tr><tr><td><code>symbol</code></td><td>true</td><td><code>string</code></td><td>a string with the symbol name</td></tr><tr><td><code>type</code></td><td>true</td><td><code>int</code></td><td>type of the order</td></tr><tr><td><code>action</code></td><td>true</td><td><code>int</code></td><td>type of action to which the trade request belongs</td></tr><tr><td><code>price_order</code></td><td>true</td><td><code>double</code></td><td>the price of an order in a trade request</td></tr><tr><td><code>price_trigger</code></td><td>true</td><td><code>double</code></td><td>the price, at which a Limit order is placed when the Stop Limit order triggers</td></tr><tr><td><code>tp</code></td><td>true</td><td><code>double</code></td><td>the Take Profit level</td></tr><tr><td><code>sl</code></td><td>true</td><td><code>double</code></td><td>the Stop Loss level</td></tr><tr><td><code>volume</code></td><td>true</td><td><code>double</code></td><td>the Volume of opened trade requests</td></tr></tbody></table>

**Example:**

```json
{
    "type": "OpenOrder", 
    "id":11, 
    "body": {
        "result": 10009, 
        "ticket":154192, 
        "symbol": "EURUSD", 
        "type": 2, 
        "action": 201, 
        "price": 0, 
        "price_order": 0, 
        "price_trigger": 0, 
        "tp": 0, 
        "sl": 0, 
        "volume": 0.01, 
        "time":0
        }
}
```
