MetaTrader 5 Build 1430: Updated Exposure tab

Implemented the new algorithm of forming the Exposure tab for an exchange market

16 September 2016

Terminal

  1. Implemented the new algorithm of forming the Exposure tab for an exchange market. Now, the platform adapts the display of assets depending on the risk management system applied to a trading account: Retail Forex, Futures or Exchange model.

    The Assets section is helpful for those trading Forex or futures at an exchange showing their current status on the market. Same currencies can be found in a variety of different symbols: as one of the currencies in a pair, as a base currency, etc. For example, you may have oppositely directed positions on GBPUSD, USDJPY and GBPJY. In this situation, it is very difficult to understand how much currency you have and how much you need. Having more than three positions further complicates the task. In this case, the total account status can be easily seen in the Assets tab.
    Let's use the same three positions as an example:

    Buy GBPJPY 1 lot at 134.027 — received 100 000 GBP, given 134 027 000 JPY
    Sell USDJPY 1 lot at 102.320 — given 100 000 USD, received 102 320 000 JPY
    Sell GBPUSD 1 lot at 1.30923 — given 100 000 GBP, received 103 920 USD

    We have bought and sold 100 000 GPB simultaneously. We have 0 GBP, and the Assets tab does not display this currency. As of USD, we gave a currency in one case and received it in another. The Assets tab calculates the final outcome and adds it to the current balance since the deposit currency is USD as well. JPY participated in two deals meaning that the tab displays its total value.




    Those using the exchange model can use the section to understand how their money is used. Unlike the previous model, the funds are withdrawn/added right when deals are performed. For example, if you buy EURRUB, you receive EUR at once while the appropriate sum in RUB is withdrawn from the balance. During trading, the account balance may even become negative: when you use borrowed money while purchased assets are used as the collateral. In this case, the Assets tab allows you to easily understand the trading account status.

    Additionally, you can see the liquidation value here — amount of funds on the account and the price (result) of closing all current positions at the market price.





  2. Fixed deal type display in the history of trading operations.
  3. Terminal: Fixed repeated risk notification window display when re-connecting to a trading account.
  4. Optimized and fixed working with the trading symbol selection dialog in case of a large number of symbols (several thousands and more).
  5. Fixed display of levels of built-in indicators calculated based on Moving Average (Bollinger Bands, Adaptive Moving Average, etc.). Previously, an error occurred when plotting indicators in a separate subwindow.
  6. Fixed an error that could occasionally interfere with placing a futures contract order in case an order price coincides with the upper or lower contract price limit.

MQL5

  1. Optimized and accelerated compilation of MQL5 applications.
  2. Added support for 'final' and 'override' modifiers for classes, structures and functions.

    'final' modifier for classes and structures
    The presence of the 'final' modifier when declaring a structure or a class prohibits the further inheritance from it. If there is no need to make any further changes in the class (structure) or such changes are unacceptable for security reasons, declare that class (structure) with the 'final' modifier. In this case, all class methods are also implicitly considered 'final'.
    class CFoo final
      {
      //--- class body
      };
     
    class CBar : public CFoo
      {
      //--- class body
      };
    When attempting to inherit from a class with the 'final' modifier as shown above, the compiler displays an error:
    cannot inherit from 'CFoo' as it has been declared as 'final'
    see declaration of 'CFoo'

    'override' modifier for functions
    The 'override' modifier means that a declared function should always override the parent class method. Using the modifiers allows you to avoid errors when overriding, such as accidental change of a method signature. For example, the 'func' method accepting the 'int' type variable is defined in the base class:
    class CFoo
      {
       void virtual func(int x) const { }
      };
    The method is overridden in the inherited class:
    class CBar : public CFoo
      {
       void func(short x) { }
      };
    But the argument type is mistakenly changed from 'int' to 'short'. In fact, the method overload instead of overriding is performed in that case. While acting according to the overloaded function definition algorithm, the compiler may in some cases select a method defined in the base class instead of an overridden one.

    In order to avoid such errors, the 'override' modifier should be explicitly added to the overridden method.
    class CBar : public CFoo
      {
       void func(short x) override { }
      };
    If the method signature is changed during the overriding process, the compiler cannot find the method with the same signature in the parent class issuing the compilation error:
    'CBar::func' method is declared with 'override' specifier but does not override any base class method

    'final' modifier for functions

    The 'final' modifier acts in the opposite way — it disables method overriding in derived classes. If the method implementation is self-sufficient and fully completed, declare it with the 'final' modifier to ensure it is not changed later.
    class CFoo
      {
       void virtual func(int x) final { }
      };
     
    class CBar : public CFoo
      {
       void func(int) { }
      };
     
    When attempting to override a method with the 'final' modifier as shown above, the compiler displays an error:
    'CFoo::func' method declared as 'final' cannot be overridden by 'CBar::func'
    see declaration of 'CFoo::func'
  3. Fixed compiling template functions with default parameters.

Market

  1. Fixed a few errors in sorting Market products.

Tester

  1. Fixed updating the current market prices for open orders and positions in the visual testing mode.
  2. Removed slippage during Buy Limit and Sell Limit order execution when testing using exchange symbols.
  3. Fixed occasional generation of incorrect prices in "Open prices" testing mode.
  4. Fixed generation of OnTradeTransaction events when testing.
  5. When testing based on real ticks, the data on the mismatch of tick prices (bid or last depending on the price used to generate a bar) and low or high values of the existing minute bar appears in the tester log.

MetaEditor

  1. Fixed displaying the data profiling in source code files.

Updated documentation.