Managing Pending Trading Requests with Timer-Based Objects
Summary
This article describes extending a MetaTrader trading library to manage pending requests for order operations. It makes the request manager a descendant of the main trading class, with timer processing divided between base trading behavior and pending-request handling. A separate pause object measures elapsed milliseconds without stopping program execution, allowing waits to be managed by the timer rather than depending on market ticks.
The design also moves shared methods, such as logging controls and magic-number data access, into a common base object. Request objects gain actual order-property values so the manager can compare request and order states and remove completed requests. Example test logs show repeated operations on the same ticket and a request being deleted after completion. The author says other pending-request operations still need careful testing in later development, so the examples demonstrate an evolving library implementation rather than a complete validation of all cases.
Key ideas
- A timer-based manager can track pending trading requests without relying on incoming ticks.
- A pause object measures elapsed time without blocking program execution with a sleep call.
- Comparing actual order properties with request properties helps identify completed operations.
- Moving repeated methods into a shared base class reduces duplication across library objects.
- The reported tests cover repeated operations on one ticket, while other cases remain to be checked.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.