Skip to content

moveStops: Change the stop loss and/or take profit of one position

View as Markdown

Change the stop loss and/or take profit of one position.

  • 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) or ticket

  • HTTP 200 means queued, not executed. See how delivery works and find where an alert stopped.

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.

Replace YOUR_LICENSE_KEY with your key. Send the body as the alert message in TradingView, or with any HTTP client.

{
"license": "YOUR_LICENSE_KEY",
"action": "moveStops",
"positionID": "eurusd_breakout_1",
"sl": 1.085,
"tp": 1.105
}
{
"license": "YOUR_LICENSE_KEY",
"action": "moveStops",
"positionID": "eurusd_breakout_1",
"sl": 1.087
}

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.

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).

Verified for EA v1.9 · dashboard 2026-10-05 · reviewed by Claude Code (owner review pending)

Report a problem with this page

Trading involves substantial risk of loss. ZB Connector is software only; it does not provide investment advice, signals or brokerage services.