Skip to content
All library documents

Managing Grid Entries, Exits, and Drawdown with GridManager

Article MQL5 code base

Summary

The document describes a basic grid-trading library through its public controls and a sample expert-advisor workflow. A grid is configured with a direction, initial lot size, spacing between grid levels, and a profit target. Optional settings assign a magic number, apply a lot-size multiplier, and set a maximum drawdown as a percentage of account balance.

The sample starts a buy grid when a condition is true and calls an update routine on each market tick. The library checks for additional entries and possible exits; it also offers methods to close the grid and inspect profit and open-position count. The described controls show how to organize grid operations, but the document provides no performance evidence or details about how entries, exits, and risk limits are calculated internally. A multiplier can increase exposure as positions accumulate, and the drawdown limit is described as disabled unless explicitly set, so these settings alone do not establish that a grid is safe or profitable.

Key ideas

  • A grid is initialized with its direction, starting position size, spacing, and profit target.
  • The manager can set a maximum drawdown limit measured as a percentage of balance.
  • Starting and updating the grid are separate operations in the sample workflow.
  • The library exposes functions to close the grid and inspect its profit and position count.

Tags

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