Skip to content
All library documents

A Step-Based Grid Expert Advisor with Virtual Take Profit

Article MQL5 code base

Summary

The expert advisor begins by opening a buy position, then tracks the opening prices of buy and sell positions separately. It adds a buy when the latest buy entry is at least the configured step above the current ask, and adds a sell when the latest sell entry is at least the step below the current bid. This makes each side add positions after price moves against its most recent entry. Position size, step distance, and a virtual take-profit threshold are user inputs.

The advisor monitors open trades and closes a position at market when its profit reaches the virtual take-profit level. The document describes the operating logic and inputs, but provides no rules for stopping the system, limiting total exposure, or handling losses, and reports no testing or performance results. Since positions can accumulate as price moves against the latest entry, risk depends on market movement and the configured settings; the virtual profit exit alone does not specify a loss limit.

Key ideas

  • The advisor opens an initial buy position and records buy and sell entry prices separately.
  • It adds positions when price moves against the latest entry by at least the configured step.
  • Each position is closed at market when its profit reaches the virtual take-profit threshold.
  • The user configures position size, step distance, take-profit level, and an identifier.
  • The description gives no loss limit, total exposure cap, or performance evidence.

Tags

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