MetaTrader 5 build 3260: Bulk operations, matrix and vector functions, and chat enhancements

What's new in MetaTrader 5

15 April 2022

Terminal

  1. Added commands for bulk closing of positions and cancellation of pending orders.
    New "Bulk Operations" command has been added to the context menu of the Trade tab. The list of available commands is formed automatically, depending on the selected operation and on your account type.



    The following commands are always available in the menu:
    • Closing all positions On hedging accounts, the system tries to close positions by opposite ones (Close By), and then it closes the remaining positions following a regular procedure.
    • Close all profitable or all losing positions
    • Delete all pending orders
    • Delete pending orders of certain types: Limit, Stop, Stop Limit

    If you select a position, additional commands appear in the menu:
    • Close all positions for the symbol
    • Close all positions in the same direction (on hedging accounts)
    • Close opposite positions for the same symbol (on hedging accounts)
    • Position reversal (on netting accounts)

    If you select a pending order, additional commands appear in the menu:
    • Delete all pending orders for the same symbol
    • Delete all pending orders of the same type for the same symbol

    These commands are only available if One Click Trading is enabled in platform settings: Tools \ Options \ Trade.
  2. Enhanced internal chart features:
    • Added ability to reply to messages. The source message text will be cited in the reply.
    • Added ability to create messages with different content types, such as images with text and text with attachments, among others.
    • Fixed display of the separator between read and unread messages.
    • Error fixes and stability improvements.



  3. Optimized and accelerated operation of the terminal's graphical system. Interface rendering will require less resources.
  4. Fixed calculation of daily price changes for futures. If the broker provides a clearing price, this price will be used for calculations.
    ((Last - Clearing Price)/Clearing Price)*100
    A detailed description of all calculation types is available in the Documentation.

  5. Fixed errors during MQL5 service purchases:
    • Payment systems could return errors for successful operations under certain conditions.
    • An incorrect price could be displayed at intermediary product renting steps in the Market.

  6. Fixed operation of the "Start" button in the purchased/downloaded Market product page. Now the button correctly launches the application on the first open chart.
  7. Fixed accounting for certain deal types when generating the history of positions.

MQL5

  1. Added new functions for working with matrices and vectors:
    • Median — returns the median of the matrix or vector elements
    • Quantile — returns the q-th quantile of matrix/vector elements or elements along the specified axis
    • Percentile — returns the q-th percentile of matrix/vector elements or elements along the specified axis
    • Std — computes the standard deviation of matrix or vector elements
    • Var — computes the variance of matrix or vector elements
    • CorrCoef — computes the matrix/vector correlation coefficient
    • Correlate — computes the cross-correlation of two vectors
    • Convolve — returns the discrete, linear convolution of two vectors
    • Cov — computes the covariance matrix

  2. We have started adding built-in methods for numeric arrays. The new methods enhance usability, increase code compactness, and improve code compatibility with other languages.

    The following three methods are already available:
    • ArgSort — sorts arrays by the specified dimension; the last one is used by default (axis=-1).
    • Range — returns the number of elements in the specified array dimension. Analogue of ArrayRange.
    • Size — returns the number of array elements. Analogue of ArraySize.

    Example:
    void OnStart()
      {
       int arr[4][5]=
         {
            {22, 34, 11, 20,  1},
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            {10, 36,  2, 12,  5},
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            {33, 37, 25, 13,  4},
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
            {14,  9, 26, 21, 59}
         };
       ulong indexes[4][5];
    //--- Sort the array
       arr.ArgSort(indexes,-1,0);
       Print("indexes");  
       ArrayPrint(indexes);
      }
    
    // Result log:
    // indexes
    //     [,0][,1][,2][,3][,4]
    // [0,]   4   2   3   0   1
    // [1,]   2   4   0   3   1
    // [2,]   4   3   2   0   1
    // [3,]   1   0   3   2   4

  3. We have started adding built-in methods for strings.
    The following methods are currently available:
    • BufferSize — returns buffer size allocated for the string.
    • Compare — compares two strings and returns the comparison result as an integer.
    • Length — returns the number of characters in a string.
    • Find — searches for a substring in a string.
    • Upper — capitalizes a string.
    • Lower — converts a string to lowercase.
    • Replace — replaces a substring.
    • Reserve — reserves a buffer for a string.

    All methods are analogous to string functions.

      Example:
      void OnStart()
        {
         string test="some string";
         PrintFormat("String length is %d",test.Length());
        }
      
      // Result log:
      // String length is 11
    • Added SYMBOL_SUBSCRIPTION_DELAY value into the ENUM_SYMBOL_INFO_INTEGER enumeration for the delay in quotes delivery for specific symbols.

      It is only used for subscription-based trading symbols. The delay is usually applicable to data provided in trial mode.

      The property can only be requested for symbols selected in the Market Watch. Otherwise, the ERR_MARKET_NOT_SELECTED (4302) error will be returned.

    • Added ACCOUNT_HEDGE_ALLOWED property into the ENUM_ACCOUNT_INFO_INTEGER enumeration — enables the opening of opposite positions and pending orders. The property is only used for hedging accounts to comply with specific regulatory requirements, according to which an account cannot have opposite positions for the same symbol, while same-direction positions are allowed.

      If this option is disabled, accounts are not allowed to have opposite-direction positions and orders for the same financial instrument. For example, if the account has a Buy position, the user cannot open a Sell position or place a pending Sell order. If the user tries to perform such an operation, the TRADE_RETCODE_HEDGE_PROHIBITED error will be returned.

    • New properties in the ENUM_SYMBOL_INFO_DOUBLE enumeration:
      • SYMBOL_SWAP_SUNDAY
      • SYMBOL_SWAP_MONDAY
      • SYMBOL_SWAP_TUESDAY
      • SYMBOL_SWAP_WEDNESDAY
      • SYMBOL_SWAP_THURSDAY
      • SYMBOL_SWAP_FRIDAY
      • SYMBOL_SWAP_SATURDAY

      Use the values to obtain swap calculation rates for specific days of the week. 1 — single swap, 3 — triple swap, 0 — no swap.

    • Fixed operation of CopyTicks and CopyTicksRange functions. An error could cause the return of outdated data when crossing through midnight. The error occurred when no ticks were provided for the financial instrument.
    • Fixed errors reported in crash logs.