New article Library for easy and quick development of MetaTrader programs (part XXVII):
Working with trading requests - placing pending orders has been published:
In this article, we will continue the development of trading requests, implement placing pending orders and eliminate detected
shortcomings of the trading class operation.
In the previous article, we started the
implementation of pending trading requests and created the first pending request for opening a position in case an error is received in
the trading class after sending a request to the server. In this article, we will resume the development of pending requests and
implement creation of a pending request in case of errors occurred when setting pending orders.
While testing the trading class, I have detected some shortcomings. In particular, when initializing symbol's trading objects in the
class constructor, hard-set default values were set for them. Not all of those values may have been supported in the symbol
specification. This caused server errors when attempting to place pending orders — the server activated the unsupported order
expiration type error. This error was not corrected anywhere and eventually led to the inability to place a pending order. When sending
a trading request with default values, some unsupported data was also sent to the trading request. To solve this issue, I had to specify
correct data corresponding to the appropriate symbol specification directly in the trading request
Author: Artyom Trishkin