Skip to content
All library documents

Assisted Position Closing with Stop-Loss and Take-Profit Rules

Article MQL5 code base

Summary

The document describes a trading utility that helps close positions according to a configured stop-loss amount and a take-profit multiple of that amount. The stop-loss input must be negative. It describes two stop-loss approaches: setting a stop on an order to guide position closure, or closing the position based on a multiple of the entered value. The stated aim is to enforce consistent loss limits and discourage discretionary stop changes.

The tool has an important limitation: it does not recognize pending orders. A stop loss set directly on an order can remain in place without the utility running, which the document presents as useful when managing both longer-term and shorter-term trades. The source gives no performance results, detailed calculation rules, or examples of how the take-profit multiple interacts with different position sizes. It is therefore a description of a risk-control aid rather than evidence that the closing rules improve trading outcomes.

Key ideas

  • The stop-loss amount must be entered as a negative value for the utility to operate.
  • The take-profit level is defined as a multiple of the stop-loss input.
  • A stop can be set on an order or managed through a multiple-based position-closing rule.
  • The tool does not recognize pending orders.
  • An order-level stop can remain active without the utility running.

Tags

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