Skip to content
All library documents

Closing Equal-Risk Position Baskets When Combined PnL Turns Positive

Article MQL5 code base

Summary

The document describes an expert advisor rule for managing a basket of open positions. A user sets a position-count threshold, n. Below that threshold, the advisor takes no action. When the count reaches n, it closes the existing positions if their combined profit and loss is positive. At or above n positions, it continues checking the basket and closes all positions once their total PnL becomes positive.

The stated rationale is to limit basket growth and periodically realize profits. Positions should carry the same amount of risk, which may require different lot sizes across instruments with different volatility. This is a concise rule description rather than a tested strategy: it gives no evidence about returns, drawdowns, transaction costs, or behavior when basket PnL remains negative. The method also does not specify how n is chosen or how risk equivalence is measured, so those decisions remain with the trader.

Key ideas

  • The advisor does nothing while the number of open positions is below a chosen threshold.
  • At the threshold, it closes the basket if aggregate PnL is positive.
  • Once the basket reaches the threshold, it closes all positions when combined PnL turns positive.
  • Positions should have comparable risk, even when their lot sizes differ.
  • The document gives no performance evidence or guidance for setting the threshold.

Tags

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