Trading
Trading functionallity
Send market or pending order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Symbol
"EURUSD"Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop
"Buy""Buy" | "Sell" | "BuyLimit" | "SellLimit" | "BuyStop" | "SellStop" | "BuyStopLimit" | "SellStopLimit" | "CloseBy" | "Balance" | "Credit"Lots
0.1doublePrice. Optional, but required in case of Instant Execution.
0doubleSlippage. Optional.
0int64StopLoss. Optional.
0doubleTakeProfit. Optional.
0doubleComment. Optional.
Custom user field. You can specify any value up to your needs. In MT5 this parameter called 'magic number.'
0int64For the StopLimit order. Optional.
0doubleExpiration time in yyyy-MM-ddTHH:mm:ss format
date-timeExpiration type
"Specified""GTC" | "Today" | "Specified" | "SpecifiedDay"Who placed the order
"Manually""Manually" | "ByExpert" | "ByDealer" | "OnSL" | "OnTP" | "OnStopOut" | "OnRollover" | "OnVmargin" | "Gateway" | "Signal" | "Settlement" | "Transfer" | "Sync" | "ExternalService" | "Migration" | "Mobile" | "Web" | "OnSplit" | "Default"Response Body
curl -X GET "https://api.metatraderapi.dev/OrderSend?id=%7B%7Bid%7D%7D&symbol=EURUSD&operation=Buy&volume=0.1&price=0&slippage=0&stoploss=0&takeprofit=0&comment=string&expertID=0&stopLimitPrice=0&expiration=2019-08-24T14%3A15%3A22Z&expirationType=GTC&placedType=Manually"{
"ticket": 0,
"profit": 0.1,
"swap": 0.1,
"commission": 0.1,
"fee": 0.1,
"closePrice": 0.1,
"closeTime": "2019-08-24T14:15:22Z",
"closeLots": 0.1,
"closeComment": "string",
"openPrice": 0.1,
"openTime": "2019-08-24T14:15:22Z",
"lots": 0.1,
"contractSize": 0.1,
"expertId": 0,
"placedType": "Manually",
"orderType": "Buy",
"dealType": "DealBuy",
"symbol": "string",
"comment": "string",
"state": "Started",
"stopLoss": 0.1,
"takeProfit": 0.1,
"requestId": 0,
"digits": 0,
"profitRate": 0.1,
"stopLimitPrice": 0.1,
"dealInternalIn": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
},
"dealInternalOut": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
},
"orderInternal": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"symbol": "string",
"historyTime": 0,
"openTime": 0,
"expirationTime": 0,
"executionTime": 0,
"type": "Buy",
"fillPolicy": "FillOrKill",
"expirationType": "GTC",
"placedType": "Manually",
"openPrice": 0.1,
"stopLimitPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"requestVolume": 0,
"state": "Started",
"expertId": 0,
"dealTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"baseDigits": 0,
"profitRate": 0.1,
"openTimeMs": 0,
"ticket": 0,
"executionTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1,
"requestLots": 0.1,
"openTimeMsAsDateTime": "2019-08-24T14:15:22Z",
"openTimeAsDateTime": "2019-08-24T14:15:22Z"
},
"partialCloseDeals": [
{
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
}
],
"partialFillDeals": [
{
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
}
],
"closeVolume": 0,
"volume": 0,
"expirationType": "GTC",
"expirationTime": "2019-08-24T14:15:22Z",
"fillPolicy": "FillOrKill",
"openTimestampUTC": 0,
"closeTimestampUTC": 0
}{
"message": "string",
"code": "DONE",
"stackTrace": "string"
}Modify market or pending order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Order ticket
0int64StopLoss.
0doubleTakeProfit
0doublePrice
0doubleExpiartion in format: yyyy-MM-ddTHH:mm:ss
date-timeExpiration type
"Specified""GTC" | "Today" | "Specified" | "SpecifiedDay"Stop limit price for stop limit orders
0doubleResponse Body
curl -X GET "https://api.metatraderapi.dev/OrderModify?id=%7B%7Bid%7D%7D&ticket=0&stoploss=0&takeprofit=0&price=0&expiration=2019-08-24T14%3A15%3A22Z&expirationType=GTC&stoplimit=0"{
"ticket": 0,
"profit": 0.1,
"swap": 0.1,
"commission": 0.1,
"fee": 0.1,
"closePrice": 0.1,
"closeTime": "2019-08-24T14:15:22Z",
"closeLots": 0.1,
"closeComment": "string",
"openPrice": 0.1,
"openTime": "2019-08-24T14:15:22Z",
"lots": 0.1,
"contractSize": 0.1,
"expertId": 0,
"placedType": "Manually",
"orderType": "Buy",
"dealType": "DealBuy",
"symbol": "string",
"comment": "string",
"state": "Started",
"stopLoss": 0.1,
"takeProfit": 0.1,
"requestId": 0,
"digits": 0,
"profitRate": 0.1,
"stopLimitPrice": 0.1,
"dealInternalIn": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
},
"dealInternalOut": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
},
"orderInternal": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"symbol": "string",
"historyTime": 0,
"openTime": 0,
"expirationTime": 0,
"executionTime": 0,
"type": "Buy",
"fillPolicy": "FillOrKill",
"expirationType": "GTC",
"placedType": "Manually",
"openPrice": 0.1,
"stopLimitPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"requestVolume": 0,
"state": "Started",
"expertId": 0,
"dealTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"baseDigits": 0,
"profitRate": 0.1,
"openTimeMs": 0,
"ticket": 0,
"executionTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1,
"requestLots": 0.1,
"openTimeMsAsDateTime": "2019-08-24T14:15:22Z",
"openTimeAsDateTime": "2019-08-24T14:15:22Z"
},
"partialCloseDeals": [
{
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
}
],
"partialFillDeals": [
{
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
}
],
"closeVolume": 0,
"volume": 0,
"expirationType": "GTC",
"expirationTime": "2019-08-24T14:15:22Z",
"fillPolicy": "FillOrKill",
"openTimestampUTC": 0,
"closeTimestampUTC": 0
}{
"message": "string",
"code": "DONE",
"stackTrace": "string"
}Close market or pending order
Your API key
In: header
Query Parameters
Your Account UUID which you connected via the Dashboard
"{{id}}"Order ticket
0int64Lots. Optional.
0doublePrice. Optional, but required in case of Instant Execution.
0doubleSlippage. Optional.
0int64Response Body
curl -X GET "https://api.metatraderapi.dev/OrderClose?id=%7B%7Bid%7D%7D&ticket=0&lots=0&price=0&slippage=0"{
"ticket": 0,
"profit": 0.1,
"swap": 0.1,
"commission": 0.1,
"fee": 0.1,
"closePrice": 0.1,
"closeTime": "2019-08-24T14:15:22Z",
"closeLots": 0.1,
"closeComment": "string",
"openPrice": 0.1,
"openTime": "2019-08-24T14:15:22Z",
"lots": 0.1,
"contractSize": 0.1,
"expertId": 0,
"placedType": "Manually",
"orderType": "Buy",
"dealType": "DealBuy",
"symbol": "string",
"comment": "string",
"state": "Started",
"stopLoss": 0.1,
"takeProfit": 0.1,
"requestId": 0,
"digits": 0,
"profitRate": 0.1,
"stopLimitPrice": 0.1,
"dealInternalIn": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
},
"dealInternalOut": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
},
"orderInternal": {
"ticketNumber": 0,
"id": "string",
"login": 0,
"symbol": "string",
"historyTime": 0,
"openTime": 0,
"expirationTime": 0,
"executionTime": 0,
"type": "Buy",
"fillPolicy": "FillOrKill",
"expirationType": "GTC",
"placedType": "Manually",
"openPrice": 0.1,
"stopLimitPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"requestVolume": 0,
"state": "Started",
"expertId": 0,
"dealTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"baseDigits": 0,
"profitRate": 0.1,
"openTimeMs": 0,
"ticket": 0,
"executionTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1,
"requestLots": 0.1,
"openTimeMsAsDateTime": "2019-08-24T14:15:22Z",
"openTimeAsDateTime": "2019-08-24T14:15:22Z"
},
"partialCloseDeals": [
{
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
}
],
"partialFillDeals": [
{
"ticketNumber": 0,
"id": "string",
"login": 0,
"historyTime": 0,
"orderTicket": 0,
"openTime": 0,
"symbol": "string",
"type": "DealBuy",
"direction": "In",
"openPrice": 0.1,
"price": 0.1,
"stopLoss": 0.1,
"takeProfit": 0.1,
"volume": 0,
"profit": 0.1,
"profitRate": 0.1,
"volumeRate": 0.1,
"commission": 0.1,
"fee": 0.1,
"swap": 0.1,
"expertId": 0,
"positionTicket": 0,
"comment": "string",
"contractSize": 0.1,
"digits": 0,
"moneyDigits": 0,
"freeProfit": 0.1,
"trailRounder": 0.1,
"openTimeMs": 0,
"placedType": "Manually",
"openTimeAsDateTime": "2019-08-24T14:15:22Z",
"lots": 0.1
}
],
"closeVolume": 0,
"volume": 0,
"expirationType": "GTC",
"expirationTime": "2019-08-24T14:15:22Z",
"fillPolicy": "FillOrKill",
"openTimestampUTC": 0,
"closeTimestampUTC": 0
}{
"message": "string",
"code": "DONE",
"stackTrace": "string"
}