POST
Modify Order or Position
Account API v2Change the stop loss, take profit or price of an open position or pending order.
POST
https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorpositionUpdate the stop loss and take profit of an open MT5 position, or the price, SL, TP and stop-limit price of a pending order, by ticket. Use it for trailing stops, break-even moves and repricing pending orders from your own code.
Authentication
Send the account token as Authorization: Bearer <ACCOUNT_TOKEN>. See Authentication.
Request body
JSON body, Content-Type: application/json.
- ticketintegerrequired
MT5 ticket of the position or pending order.
- pricenumber
New order price. Pending orders only.
- slnumber
New stop loss price.
- tpnumber
New take profit price.
- stop_limitnumber
New limit price for stop-limit pending orders.
Response
Returns the standard response envelope: status, msg and data.
Notes
- Send only the fields you want to change along with
ticket. - Moving SL to the entry price creates a break-even stop. Call this endpoint repeatedly as price moves to build a trailing stop.
Related endpoints
- Place Order: Open a market order or place a pending order (limit, stop, stop-limit) on an MT5 account.
- Get Open Positions: List every open position on the MT5 account.
- Get Pending Orders: List every pending (limit, stop, stop-limit) order on the MT5 account.
Example request
curl -X POST https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition \
-H "Authorization: Bearer $ACCOUNT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ticket": 1093918439,
"sl": 1.0856,
"tp": 1.1589
}'import os
import requests
res = requests.post(
"https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition",
headers={"Authorization": f"Bearer {os.environ['ACCOUNT_TOKEN']}"},
json={
"ticket": 1093918439,
"sl": 1.0856,
"tp": 1.1589
},
timeout=30,
)
data = res.json()
print(data["status"], data.get("msg"), data.get("data"))const res = await fetch("https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ACCOUNT_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"ticket": 1093918439,
"sl": 1.0856,
"tp": 1.1589
}),
});
const { status, msg, data } = await res.json();
console.log(status, msg, data);using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ACCOUNT_TOKEN"));
var body = new StringContent("""
{
"ticket": 1093918439,
"sl": 1.0856,
"tp": 1.1589
}
""", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());Move a pending order
curl -X POST https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition \
-H "Authorization: Bearer $ACCOUNT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ticket": 1093920001,
"price": 1.0795,
"sl": 1.075,
"tp": 1.09
}'import os
import requests
res = requests.post(
"https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition",
headers={"Authorization": f"Bearer {os.environ['ACCOUNT_TOKEN']}"},
json={
"ticket": 1093920001,
"price": 1.0795,
"sl": 1.075,
"tp": 1.09
},
timeout=30,
)
data = res.json()
print(data["status"], data.get("msg"), data.get("data"))const res = await fetch("https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ACCOUNT_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"ticket": 1093920001,
"price": 1.0795,
"sl": 1.075,
"tp": 1.09
}),
});
const { status, msg, data } = await res.json();
console.log(status, msg, data);using System.Net.Http.Headers;
using System.Text;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("ACCOUNT_TOKEN"));
var body = new StringContent("""
{
"ticket": 1093920001,
"price": 1.0795,
"sl": 1.075,
"tp": 1.09
}
""", Encoding.UTF8, "application/json");
var res = await http.PostAsync("https://api.algodeltafx.com/api/v2/forexaccount/modifyorderorposition", body);
Console.WriteLine(await res.Content.ReadAsStringAsync());Last updated 2026-11-04