moveStopsBreakeven: Move the stop loss of one position to its entry price, with an optional offset
Move the stop loss of one position to its entry price, with an optional offset.
At a glance
Section titled “At a glance”-
Action:
moveStopsBreakeven(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 moveStopsBreakeven. 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. |
offset |
number | No | pips | Pips beyond the entry price, in the profit direction. 0 puts the stop exactly at entry. A negative value leaves the stop that many pips on the losing side of entry. Default: 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.
Stop loss to entry plus 2 pips
Section titled “Stop loss to entry plus 2 pips”{ "license": "YOUR_LICENSE_KEY", "action": "moveStopsBreakeven", "positionID": "eurusd_breakout_1", "offset": 2}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"moveStopsBreakeven","positionID":"eurusd_breakout_1","offset":2}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "moveStopsBreakeven", "positionID": "eurusd_breakout_1", "offset": 2}"""
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": "moveStopsBreakeven", "positionID": "eurusd_breakout_1", "offset": 2 }),});console.log(response.status, await response.text());Stop loss exactly at entry
Section titled “Stop loss exactly at entry”{ "license": "YOUR_LICENSE_KEY", "action": "moveStopsBreakeven", "positionID": "eurusd_breakout_1"}curl -X POST "https://dev.api.zb-connector.com/webhook/" \ -H "Content-Type: application/json" \ -d '{"license":"YOUR_LICENSE_KEY","action":"moveStopsBreakeven","positionID":"eurusd_breakout_1"}'import requests
payload = """{ "license": "YOUR_LICENSE_KEY", "action": "moveStopsBreakeven", "positionID": "eurusd_breakout_1"}"""
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": "moveStopsBreakeven", "positionID": "eurusd_breakout_1" }),});console.log(response.status, await response.text());What you see
Section titled “What you see”After a successful run the MT5 Experts log shows:
✓ moveStopsBreakeven: SL moved to <price> for position <positionID> (offset=<pips> pips)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: moveStopsBreakeven needs positionID |
Neither positionID nor ticket reached the EA. |
Send positionID or ticket. |
| MT5 Experts log | ❌ moveStopsBreakeven: 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 price has not moved far enough from entry for the broker to accept the stop there. | Wait until the position is further in profit, or use a smaller offset. |
- The take profit is kept.
- One pip is 10 points of the symbol (the EA’s definition, the same for every symbol).
- Only the first matching position is changed.
Related
Section titled “Related”- Commands overview and the cheat sheet
- moveStops: change the stop loss and/or take profit of one position
- 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.