Skip to content
All library documents

Break-Even and Trailing Stops for Manual Forex Order Management

Article MQL5 code base

Summary

The document describes an Expert Advisor for manual trading that applies stop-loss and take-profit levels to market and pending orders. Its controls include when trailing begins, the trailing distance from the current price, the profit threshold for moving a stop to break-even, and the amount of profit to lock in. An example explains a buy position whose stop is moved into profit and then trailed as price advances.

Additional functions can close all open orders when account profit reaches a percentage of balance or a specified cash amount, or close an order on the current pair at a specified profit. A stealth setting keeps calculated stop and target levels off the broker’s order record and closes positions locally when those thresholds are reached. The text provides a functional description, not performance testing. It requests demo testing of stealth mode and gives no evidence about execution reliability, broker compatibility beyond digit formats, or risks from local monitoring.

Key ideas

  • The advisor can set protective stops and profit targets for market and pending orders.
  • Trailing controls define when a stop begins following price and its distance from the current price.
  • Break-even settings specify the gain threshold and profit amount to preserve through a stop adjustment.
  • Account-level and order-level profit thresholds can trigger position closures.
  • Stealth mode monitors calculated stop and target levels locally instead of sending them to the broker.

Tags

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