Skip to content
All library documents

Closing Positions by Profit, Loss, Elapsed Time, or Clock Time

Article MQL5 code base

Summary

The document describes an expert advisor that monitors open positions and closes those meeting configured conditions. Position selection can be filtered by magic number or by result, and the tool can be used to implement hidden stop-loss and take-profit behavior.

It also explains that scheduled closing depends on setting the correct GMT offset, including fractional-hour offsets expressed as hours and minutes. The document provides no performance results or detail on how conditions interact, how positions are handled during market closures, or how execution failures are managed. It is an operational description of position management, not evidence of a trading strategy’s profitability.

Key ideas

  • An expert advisor can close open positions when configured conditions are met.
  • Position selection can use a magic number or the position’s result.
  • The tool can support hidden stop-loss and take-profit rules.
  • Scheduled closing requires an accurate GMT offset, including minutes where needed.

Tags

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