• Visão global
  • Comentários
  • Discussão

RestoreOrdersMT4

The script is designed for restoring previously removed or closed orders from history. Restoration is possible for pending and market orders, one at a time or multiple orders of the currency pair the script is running on.


Input parameters

  • Order's string - string of orders to be restored from history, separated by commas.
  • How to find - two methods for finding orders in history:
    • Find By Position - search by the index number of the order in the history. The last order in the history is the order with an index of "zero", the one before it has the index "one" and so one (see the first screenshot). For this search method, the script assumes that a sequence of order index numbers in history is specified in the "Order's string": parameter, for example: "0,3,6,1". This is the default value.
    • Find By Ticket - in this case, the orders will be found by ticket numbers. For this search method, the script assumes that a sequence of order tickets from history is specified in the "Order's string": parameter, for example: "83825259,84069162".
  • Action - what the script is supposed to do:
    • Only Scan & Test - check the history, determine which orders from the user-defined list (Order's string) can be restored. Corresponding notes will be output in the journal. This is the default value.
    • Real Restore - restore all orders that can be restored, according to the following rules:
      1. It is possible to restore only the orders that had been opened on the same currency pair the script is running on. In the attached screenshot, those are order number four (4) and number five (5).
      2. Restoration is performed by opening a new order. Therefore, it is not possible to preserve the ticket number. The order type, lot size, stop loss, take profit, magician and comment to warrant are subject to restoration. These parameters are taken from the history.
      3. The market orders are restored with the trade operation replaced. Buy orders are replaced by pending buy orders: if the restored order's opening price is above the current Ask price at the moment of restoration, a stop order is opened, otherwise a limit order is placed. Sell orders are replaced by pending sell orders: if the restored order's opening price is below the current Bid price at the moment of restoration, a stop order is opened, otherwise a limit order is placed.
  • Bad Price Reaction - reaction of the script in case it fails to place a pending order, because it is too close to the current market price:
    • Return - skip this order and do nothing
    • Send Market Order - open a market order Since this reaction may be unexpected by the trader, a message box asking if opening is needed will be created in advance. A market order will be opened only when approved by the trader. This is the default value.
Sem comentários