Skip to content
All library documents

Automating Stop Losses, Profit Targets, Profit Locks, and Trailing Stops

Article MQL5 code base

Summary

This document describes an Expert Advisor for managing stop loss and take profit levels, locking in profits, and applying trailing stops. Stop and target levels may be hidden or placed with the broker. The software evolved through versions that added hidden-order modes, alerts when hidden levels close a trade, profit locking, and several trailing-stop methods: classic, step-based while maintaining distance, and step-by-step.

The note instructs users to begin with orders that have stop loss and take profit set to zero so the advisor can apply its settings; setting a feature's value to zero disables it. It does not explain the algorithms, broker-specific behavior, execution risks, or provide tests or performance results. In particular, the description alone does not establish how hidden stops behave during platform disconnection or fast markets. The tool is an order-management utility, and its suitability depends on the trading platform and configuration.

Key ideas

  • The advisor can manage stop losses, take profit levels, profit locks, and trailing stops.
  • Stop losses and take profit levels can be hidden or placed as orders.
  • Trailing-stop options include classic and two step-based methods.
  • The note says to initialize trades with stop loss and take profit set to zero for the advisor to set them.
  • No performance evidence or detailed explanation of execution behavior is provided.

Tags

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