Skip to content
All library documents

Setting or Updating Stop-Loss and Take-Profit Levels

Article MQL5 code base

Summary

The document explains how to set stop-loss (SL) and take-profit (TP) levels for open orders. Traders can specify each level as a distance in pips from the current price or as a particular price. When both formats are provided for the same level, the pip value takes precedence.

To change only one side of an order’s exit settings, provide a value only for that side. A zero for the other side leaves its existing setting unchanged. The instructions describe order-management behavior rather than a trading strategy, and give no guidance on choosing suitable levels or evaluating risk.

Key ideas

  • SL and TP levels can be entered as pip distances or specific prices.
  • When both formats are supplied for one level, the pip setting takes priority.
  • A zero value leaves the corresponding existing order setting unchanged.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.