Skip to content
All library documents

Closing All Positions at a Portfolio Profit Threshold

Article MQL5 code base

Summary

The document describes a trading rule that closes all open positions once their combined profit reaches a configured threshold. Profit is aggregated across positions without separating them by instrument symbol or strategy identifier. The condition is checked only when a new bar appears, so the rule does not continuously monitor profit between bars.

This is a brief description of an automated position-closing function, rather than a complete strategy. It does not specify the threshold value, how profit is calculated, how orders are executed, or what happens if prices move sharply between checks. No testing or performance evidence is included, so the text explains the trigger’s scope and timing but does not show its effectiveness.

Key ideas

  • The rule closes every open position when aggregate profit reaches a configured level.
  • The profit check spans instruments and strategy identifiers rather than evaluating each position separately.
  • The trigger is evaluated only when a new bar appears.
  • The description omits the threshold value, execution details, and any performance evidence.

Tags

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