Forum on trading, automated trading systems and testing trading strategies
fxsaber, 2021.06.02 10:09
At my request, the MetaQutoes has completely localized the latest update of the library into English. The latest build of the library is now available on the English page with comments in the source code translated into English.
Difference from the previous version that was available on the English-language page.
// List of changes: // 02.11.2018 // Fix: Now the MT4 position Open price cannot be zero before its triggering. // Fix: Some rare execution aspects of certain trading servers have been taken into account. // 26.11.2018 // Fix: Magic and comment of a closed MT4 position: Priority of the relevant fields of opening transactions is higher than that of closing ones. // Fix: Rare changes in MT5-OrdersTotal and MT5-PositionsTotal are taken into account while calculating MT4-OrdersTotal and MT4-OrderSelect. // Fix: Library does not take into account the orders which have opened a position, but have not been yet deleted from MT5. // 17.01.2019 // Fix: Fixed an unfortunate error in selecting pending orders. // 08.02.2019 // Add: Comment of a position is saved at partial closing via OrderClose. // If you need to modify the comment on an open position at partial closing, you can specify it in OrderClose. // 20.02.2019 // Fix: In case of no MT5 order, the library will expect the history synchronization from the existing MT5 transaction. In case of failure, it will inform about it. // 13.03.2019 // Add: Added OrderTicketID() - PositionID of an MT5 transaction or MT5 position, and the ticket of a pending MT4 order. // Add: SELECT_BY_TICKET works for all MT5 tickets (and MT5-PositionID). // 02.11.2019 // Fix: Corrected lot, commission, and Close price for CloseBy positions. // 12.01.2020 // Fix: OrderTicketID() for balance deals returns now a correct value. // Fix: Fixed SELECT_BY_TICKET - selection by OrderTicketID() (MT5-PositionID). // Fix: Changed name of the internal library method for greater compatibility with macros. // 10.04.2020 // Fix: Partially executed live pending order did not get into OrdersTotal(). // 09.06.2020 // Add: StopLoss/TakeProfit/ClosePriceRequest for closed positions are now better defined. // 10.06.2020 // Add: Added milliseconds, removed price and order rounding in OrderPrint(). // 13.08.2020 // Add: Added ability to check the performance of library parts via the MT4ORDERS_BENCHMARK_MINTIME macro. // 20.08.2020 // Fix: Taking into account the revealed features of partial order execution. // 29.08.2020 // Fix: Implemented faster working with the history of trades. // 24.09.2020 // Add: If you need to increase the priority of an MT5 order over an MT5 position when selecting a live MT4 order by SELECT_BY_TICKET (the same tickets), // this can be done by changing the ticket size to negative: OrderSelect(-Ticket, SELECT_BY_TICKET). // Add: If you need to specify the selection of only MT5 order when modifying a live MT4 order (the same tickets), // this can be done by changing the ticket size to negative: OrderModify(-Ticket, ...). // Add: OrderSelect(INT_MAX, SELECT_BY_POS) - switch to an MT5 position without checking the existence and updating. // OrderSelect(INT_MIN, SELECT_BY_POS) - switch to a live MT5 order without checking the existence and updating. // Fix: Implemented faster working with the history of trades. // 30.09.2020 // Fix: Implemented faster working with the history of trades. // 08.10.2020 // Fix: OrderSend of a market order could be executed longer due to a flaw in a fresh MT5 deal search. // 21.10.2020 // Add: To provide compatibility for MT4, added OrderTicketID() - returns OrderTicket(). // 11.11.2020 // Fix: OrderTicketID() and OrderTicketOpen() return the value type specified in TICKET_TYPE. // 06.12.2020 // Fix: The cases of incorrect SL/TP execution records in the MT5 trading history are now taken into account. // Add: The MT4ORDERS_TESTER_SELECT_BY_TICKET market forces SELECT_BY_TICKET to work in the Tester only via OrderTicketID(). // 04.05.2021 // Fix: The MT5 orders that open positions and fail to disappear are no longer added to the list of MT4 orders. // Fix: CloseBy MT5 orders no longer appear in the list of MT4 orders. // 12.05.2021 // Add: The MT4ORDERS_BYPASS_MAXTIME macro changes the constantly emerging cases of trading environment desynchronization in MT5. // 13.05.2021 // Fix: Fixed bug in OrderOpenReason(). // 14.05.2021 // Fix: The BYPASS mechanism no longer affects OrderSelect(INT_MAX, SELECT_BY_POS) and OrderSelect(INT_MIN, SELECT_BY_POS). // 01.06.2021 // Fix: Compatibility with the compiler build 2449 and higher. // Fix: Improved synchronization. ByPass.mqh must be of the latest version. // Add: OrderLots(true) - synchronized size of the selected position, taking into account all orders which close this position.
I recommend using the latest version along with the synchronization mechanism. Then all the problems that no other trading library can solve will be imperceptible.
#define MT4ORDERS_BYPASS_MAXTIME 1000000 // Max time (in microseconds) to wait for the trading environment synchronization #include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006
For this mechanism to work, you need to download this library. All complex and effective checks of the correctness of the trading environment will be done automatically, without distracting the user when writing trading logic.
- 無料取引アプリ
- 8千を超えるシグナルをコピー
- 金融ニュースで金融マーケットを探索
MT4Orders:
作者: fxsaber