Skip to content
All library documents

Managing Paired Limit Orders with Automatic Cancellation

Article MQL5 code base

Summary

This document describes a chart-based trading assistant that manages two opposing limit orders. A trader places one order on each side of the current price, then starts the assistant. When either order activates, the assistant automatically deletes the other order, displays a notification, and stops running. To use it again, the trader must place a fresh pair and restart the assistant.

The settings include an optional status comment and a Magic Number filter. The filter lets the assistant manage only orders with a chosen identifier, while a zero value is intended to track manually placed orders. This can reduce the need to monitor the chart while waiting for one side of a planned entry to fill. The description explains order handling, not a trading strategy or evidence of profitability. It does not discuss partial fills, simultaneous activation, rejected cancellation, or platform-specific execution behavior, so those cases should be checked before relying on the tool in live trading.

Key ideas

  • The assistant monitors a pair of opposing limit orders placed by the trader.
  • When one order activates, the assistant deletes the other and sends a notification.
  • The assistant stops after handling an activation and must be restarted for another pair.
  • A Magic Number filter can limit management to orders carrying the selected identifier.
  • The description does not provide performance evidence or explain edge cases such as simultaneous fills.

Tags

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