moveStops: Change the stop loss and/or take profit of one position
Change the stop loss and/or take profit of one position.
At a glance
Section titled “At a glance”-
Action:
moveStops(case-sensitive) -
Group: Change stops and trailing
-
From the dashboard: yes, on the Send Command page
-
Finds the position by:
positionID(the comment you gave it when you opened it) orticket -
HTTP 200 means queued, not executed. See how delivery works and find where an alert stopped.
Fields
Section titled “Fields”| Field | Type | Required | Unit | Description |
|---|---|---|---|---|
license |
string | Yes | text | Your license key. In examples it is written YOUR_LICENSE_KEY. |
action |
string | Yes | text | Always moveStops. Case-sensitive. |
positionID |
string | Yes, or ticket |
text | The position’s MT5 comment (the positionID you sent when opening it). If the value is all digits and no comment matches, it is matched against the position ticket. |
ticket |
integer | No | MT5 ticket | MT5 ticket of the position. Used only when positionID is empty. Allowed: greater than 0. Needs EA v1.9.1 or later. |
sl |
number | No | price level | New stop loss as a price level, whatever the Stop level mode input says. 0 or omitted keeps the current stop loss. Allowed: 0 or more. |
tp |
number | No | price level | New take profit as a price level. 0 or omitted keeps the current take profit. Allowed: 0 or more. |
Send at least one of sl and tp with a value above 0.
The webhook rejects unknown fields, missing required fields and wrong types with HTTP 422 before anything is queued. Field names are case-sensitive.
Examples
Section titled “Examples”Replace YOUR_LICENSE_KEY with your key. Send the body as the alert message in TradingView, or with any HTTP client.
Move the stop loss and the take profit
Section titled “Move the stop loss and the take profit”{ "license": "YOUR_LICENSE_KEY", "action": "moveStops", "positionID": "eurusd_breakout_1", "sl": 1.085, "tp": 1.105}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"moveStops","positionID":"eurusd_breakout_1","sl":1.085,"tp":1.105}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "moveStops", "positionID": "eurusd_breakout_1", "sl": 1.085, "tp": 1.105}"""
response = requests.post( "https://dev.api.zb-connector.com/webhook/", data=payload, headers={"Content-Type": "application/json"}, timeout=10,)print(response.status_code, response.text)const response = await fetch("https://dev.api.zb-connector.com/webhook/", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "license": "YOUR_LICENSE_KEY", "action": "moveStops", "positionID": "eurusd_breakout_1", "sl": 1.085, "tp": 1.105 }),});console.log(response.status, await response.text());Move only the stop loss
Section titled “Move only the stop loss”{ "license": "YOUR_LICENSE_KEY", "action": "moveStops", "positionID": "eurusd_breakout_1", "sl": 1.087}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"moveStops","positionID":"eurusd_breakout_1","sl":1.087}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "moveStops", "positionID": "eurusd_breakout_1", "sl": 1.087}"""
response = requests.post( "https://dev.api.zb-connector.com/webhook/", data=payload, headers={"Content-Type": "application/json"}, timeout=10,)print(response.status_code, response.text)const response = await fetch("https://dev.api.zb-connector.com/webhook/", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ "license": "YOUR_LICENSE_KEY", "action": "moveStops", "positionID": "eurusd_breakout_1", "sl": 1.087 }),});console.log(response.status, await response.text());What you see
Section titled “What you see”After a successful run the MT5 Experts log shows:
SL/TP updated for ticket <ticket> → SL: <sl>, TP: <tp>In the dashboard, the command appears in Command History on the License Details page. What each status means.
Errors and fixes
Section titled “Errors and fixes”| Where you see it | Message or code | Cause | Fix |
|---|---|---|---|
| MT5 Experts log | ❌ handleCommand: moveStops needs positionID and at least one of SL/TP>0 |
The position reference is missing, or both sl and tp are 0 or missing. |
Send positionID (or ticket) and at least one of sl / tp above 0. |
| MT5 Experts log | moveStops: Position with ID <positionID> not found |
No open position in the EA’s trade scope matches. | Check the position’s comment or ticket in MT5. |
| Broker, MT5 return code | 10016 Invalid stops in the request | The new stop is on the wrong side of the price or too close to it. | Check the value against the current price and the symbol’s stop level. |
| Broker, MT5 return code | 10025 No changes in request | The values are the same as the current ones. | Nothing to change. |
- Unlike long and short, moveStops always reads sl and tp as price levels.
- Only the first matching position is changed.
- Only positions in the EA’s trade scope are considered (by default, trades opened by this EA).
Related
Section titled “Related”- Commands overview and the cheat sheet
- moveStopsBreakeven: move the stop loss of one position to its entry price, with an optional offset
- setTrailingStop: attach a trailing stop to one position
Verified for EA v1.9 · dashboard 2026-10-05 · reviewed by Claude Code (owner review pending)
Trading involves substantial risk of loss. ZB Connector is software only; it does not provide investment advice, signals or brokerage services.