New article Library for easy and quick development of MetaTrader programs (part XXXIV):
Pending trading requests - removing and modifying orders and positions under certain conditions has been published:
In this article, we will complete the description of the pending request trading concept and create the functionality for
removing pending orders, as well as modifying orders and positions under certain conditions. Thus, we are going to have the entire
functionality enabling us to develop simple custom strategies, or rather EA behavior logic activated upon user-defined
Compile the EA and launch it in the tester in the visualization mode. To check order removal as well as order and position modification, open
two sell positions and place a sell pending order without StopLoss and TakeProfit levels. Next, create pending requests to modify stop
levels of orders and positions by price value. Wait for activation of pending requests and placing specified stop levels, and remove
orders and positions.
Then open two buy positions and place a buy pending order. After that, create pending requests to remove orders and close positions by
As we can see, stop levels were set at the intersection of a given pending request activation price level. The positions were closed
after a specified time and the order was removed.
Author: Artyom Trishkin