MT5 Webhooks API Commands

List of working commands

SAMPLE PAYLOADS

Here is the table showing the API payloads.

Payload Description and example Type
token your access token STRING
risk Risk %. Default is 1 FLOAT
action BUY
SELL
PENDING_BUY
PENDING_SELL
CLOSE_POS - Close one position
CLOSE_ALL
CANCEL_ALL - Cancel all pending orders
MODIFY - Change the SL and TP
BREAKEVEN
STRING
symbol EURUSD STRING
volume 0.01 FLOAT
price 1.00000 FLOAT
sl 0.0 FLOAT
tp 0.0 FLOAT
tp2 0.0 FLOAT
tp3 0.01 FLOAT
order_id MAGIC NUMBER, comment, ticket ID FLOAT, STRING, INT
deviation 20 INT
magic 12345 INT
comment THIS IS TEXT STRING
type_time This is expiration type:
GTC , DAY, SPECIFIED
STRING
expiration Pending expiration in minutes:

5
INT
type_filling IOC
RETURN
FOK
STRING

All supported Payload

{
"risk" : 2,
"token" : "your_access_token",
"action": "BUY",
"symbol": "EURUSD",
"volume": 0.01,
"price": 1.00000,
"sl": 0.0,
"tp": 0.0,
"deviation": 5000,
"magic": 234000,
"comment": "python script open",
"type_time": "ORDER_TIME_GTC",
"expiration": 5,
"type_filling": "ORDER_FILLING_IOC"
}

Buy Payload (with token)
{
"token": "your_access_token"
"action": "BUY",
"symbol": "EURUSD",
"volume": 0.01,
"sl": 0.0,
"tp": 0.0
}

Buy Limit/Stop with MULTIPLE TP
{
"action": "PENDING_BUY",
"symbol": "EURUSD",
"volume": 0.01,
"price": 1.00000,
"sl": 0.0,
"tp": 0.0,
"tp2": 0.0,
"tp3":0.0
}

Buy Limit / Stop Payload
{
"action": "PENDING_BUY",
"symbol": "EURUSD",
"volume": 0.01,
"price": 1.00000,
"sl": 0.0,
"tp": 0.0
}

Sell Limit/Stop Payload
{
"action": "PENDING_SELL",
"symbol": "EURUSD",
"volume": 0.01,
"price": 1.00000,
"sl": 0.0,
"tp": 0.0
}

Change SLTP based on position comment
{
"action": "MODIFY",
"order_id": "comment or ticketid",
"sl": 1.0000,
"tp": 2.0000
}

Break even positions
{
"action": "BREAKEVEN",
"order_id": "comment or ticketid",
}

Close One position
{
"action": "CLOSE_POS",
"order_id": "comment or ticketid",
}

Examples with Expiration time

Please note that expiration time may not accurately work depends on the timezone of the broker. Please test it or ask to me for further assistance.


Buy Limit/Stop with MULTIPLE TP
{
"action": "PENDING_BUY",
"symbol": "EURUSD",
"volume": 0.01,
"price": 1.00000,
"sl": 0.0,
"tp": 0.0,
"tp2": 0.0,
"tp3":0.0,
"expiration": 180,
"type_time": "ORDER_TIME_SPECIFIED"
}