Condition-Based Pending Orders with Price-Relative Distance
Summary
This article extends a MetaTrader pending-request framework so it can place pending orders after specified activation conditions are met. A request stores its conditions and order settings; a timer checks requests and sends the order when every condition is satisfied. The order’s price can either follow the market at activation or remain referenced to the price used when the request was created.
The implementation tracks the selected reference behavior and adjusts prices when needed, including when a fixed reference price becomes invalid while waiting. The article demonstrates the feature in a visual strategy tester: one request activates after both price and time conditions, while others activate by time. This is an implementation walkthrough rather than evidence of trading profitability. Its scope is order placement through a particular MQL5 library, and it does not evaluate execution quality, slippage, or performance across market conditions.
Key ideas
- Pending requests can combine account, symbol, price, and time conditions before sending an order.
- A pending order’s distance can be recalculated from the market price at activation or retained from request creation.
- A fixed reference price may need adjustment if market movement makes the intended order price invalid.
- The article demonstrates condition handling in a visual tester but does not assess profitability or execution quality.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.