Skip to content
All library documents

Operating a Semi-Automatic Grid with Staggered Lots and Profit Trailing

Article MQL5 code base

Summary

This semi-automatic trading assistant lets a user place grids of buy-stop, sell-stop, buy-limit, or sell-limit orders, then close positions by side or all at once. Users set the order count and spacing for each grid type, as well as the initial lot size and a fixed increment for later orders. The example shows position size increasing by the same increment at each level, so exposure grows as more orders are filled.

The assistant can close the grid when total profit reaches a chosen amount, or begin trailing after a profit threshold and close if gains fall by a specified amount. The example illustrates this trailing sequence and says pending orders are removed on closure; the user can then choose to place the grid again. The tool requires button input and visual-mode testing. The document gives no evidence of profitability and does not discuss drawdowns or safeguards against accumulating exposure in adverse price moves.

Key ideas

  • The assistant supports buy and sell grids using stop and limit pending orders.
  • Users configure order counts, spacing, the initial lot, and a fixed lot increment.
  • Later grid levels can use progressively larger position sizes.
  • A total-profit target or trailing-profit rule can trigger grid closure.
  • The assistant requires manual button input and visual-mode testing, and no performance evidence is supplied.

Tags

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