Skip to content
All library documents

Virtual Pending Orders and State Persistence in Multi-Currency EAs

Article MQL5 articles

Summary

This installment in a multi-currency EA series extends virtual position handling to pending buy and sell limit and stop orders. It proposes representing pending orders and positions with one class: when market price reaches an order’s trigger, the object changes type into a position and notifies the relevant strategy components. The class also tracks order price, expiration, and whether expiration has occurred; tick processing checks expiration, triggers, and position closing conditions. The article further sets out visualizing virtual orders and positions and saving EA state so operation can resume after a terminal restart or move.

The article reports tests of an EA containing roughly 170 strategy instances across symbols and timeframes, using a period described as out of sample and two drawdown settings. It cautions that the reported results do not ensure future repetition and acknowledges the risk of overtraining. The excerpt gives no detailed performance statistics, so the tests are illustrative rather than enough to establish robustness or live-trading suitability.

Key ideas

  • A single virtual-order class can represent pending orders and positions by changing its order type when triggered.
  • Virtual pending orders need an entry price and expiration handling in addition to position properties.
  • Tick processing can check expiration and trigger conditions before managing an open position’s stops or targets.
  • Visualizing virtual orders and saving EA state support development checks and recovery after interruption.
  • The reported multi-strategy tests do not establish that results will persist in future markets.

Tags

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