Skip to content
All library documents

Managing MT5 Trades with Automatic Stops, Break-Even, and Trailing Stops

Article MQL5 code base

Summary

This document describes a MetaTrader 5 trade-management expert advisor for open manual forex trades. It can assign stop-loss and take-profit levels in pips, move a stop to break-even after a chosen profit threshold, and trail the stop as price moves. Users can set activation thresholds, trailing distance, and minimum adjustment steps.

The manager can be limited to the chart’s currency pair or applied across open pairs. Stop and target levels may be handled by the broker or kept hidden, with the advisor closing trades when hidden levels are reached. It also displays daily profit and loss in pips and account currency. The document explains configurable functions but provides no testing, performance evidence, or discussion of execution failures, slippage, or platform availability. These controls manage exits on existing trades; they do not specify an entry strategy or establish that the settings improve trading outcomes.

Key ideas

  • The advisor can attach stop-loss and take-profit levels to open trades.
  • Break-even protection activates after a configurable profit threshold.
  • A trailing stop follows price using configurable start, distance, and step settings.
  • Trade management can apply to the current pair or all open pairs.
  • Stop and target handling can be broker-visible or implemented in hidden mode.

Tags

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