MetaTrader 5 Platform build 1375: Time & Sales and access to ticks during testing

The Time & Sales feature has been added to the Market Depth. What is Time & Sales?

15 July 2016

Terminal

  1. The Time & Sales feature has been added to the Market Depth.




    What is Time & Sales?
    The Time & Sales feature provides the price and time of every trade executed on the exchange. Information on every trade includes the time when the trade was executed, its direction (buying or selling), as well as the price and volume of the trade. For easy visual analysis, different colors are used to indicate different trade directions: blue is used for Buy trades, pink for Sell trades, green means undefined direction. Trade volumes are additionally displayed in a histogram.

    How Time & Sales can help you understand the market
    The Time & Sales feature provides tools for a more detailed market analysis. The trade direction suggests who has initiated the trade: the buyer or the seller. The volume of trades allows traders to understand the behavior of market participants: whether the trades are performed by large or small market players, as well as estimate the activity of the players. The trade execution speed and the volume of trades on various price levels help traders to estimate the importance of the levels.

    How to use Time & Sales data
    In addition to the visual analysis of the table, you can save the details of trades to a CSV file. Further, they can be analyzed using any other software, such as MS Excel. The file contains comma-separated data:
    Time,Bid,Ask,Last,Volume,Type
    2016.07.06 16:05:04.305,89360,89370,89370,4,Buy
    2016.07.06 16:05:04.422,89360,89370,89370,2,Buy
    2016.07.06 16:05:04.422,89360,89370,89370,10,Buy
    2016.07.06 16:05:04.669,89360,89370,89370,1,Buy
    2016.07.06 16:05:05.968,89360,89370,89360,7,Sell
    If you want to save data to a file, open the context menu:



    The broker's platform should be updated to version 1375, in order to enable proper detection of trade direction.
  2. The time between the arrival of a new tick/Market depth change and call of OnTick and OnCalculate has been significantly reduced. Also the time between the arrival of a trade state change event and call of OnTick and OnCalculate has been reduced. Now MQL5 programs provide a faster response to market events.
  3. Trade requests are now sent faster when extended authentication with SSL certificates is used.
  4. User interface translation into Persian has been updated.
  5. Fixed display of SL/TP setting commands in the context menu of the chart when working in the hedging mode.

Tester

  1. A new tester feature allows requesting tick history while testing using the CopyTicks function. In earlier versions, access to ticks was not available in the Strategy Tester.

    • In the "Every tick" mode, the function will return the history of generated ticks. It is possible to request up to 128,000 last ticks.
    • In the "Every tick based on real ticks" mode, the function will return the history of real ticks. The depth of the requested data depends on the availability of history data. However, note that last 128,000 ticks are cached in the Strategy Tester, and the request will be performed quickly. A deeper history is requested from a hard disk, so the request execution can take much more time.
    • The function will not work in the modes "Open price only" and "1 minute OHLC", because tick history is not created in these modes.

  2. Added support for milliseconds. In previous versions, the time quantum in the Strategy Tester was equal to one second.

    • Now the EventSetMillisecondTimer and Sleep functions are more accurate in the Tester.
    • The accuracy of tick feeding during multi-currency EA testing has been increased. In earlier versions, if one second contained multiple ticks (i.e. the tick volume of a one-minute bars exceeded 60), the same time was set for all these ticks. It does not matter when testing single-currency Expert Advisor, because ticks are sequentially passed to the Expert Advisor. However, when you test an Expert Advisor on multiple pairs, it is important to know the pair, from which the tick has arrived first. In earlier versions, ticks of each symbol were passed to the Expert Advisor sequentially: first, all the ticks within one second for one symbol, then all the ticks for another symbol. Now they are sent taking into account milliseconds.

      When real ticks are used in testing, milliseconds are taken from the source tick data. When ticks are generated, milliseconds are set in accordance with the tick volume. For example, if 3 ticks fit within one second, their millisecond time will be equal to 000, 333 and 666.

  3. In the "Open prices only" and "1 minute OHLC" modes, pending and SL/TP orders are now executed at the requested price, not the current price at the time of execution. The algorithm of execution at market prices used in accurate modes (every tick and real ticks), is not suitable for less accurate modes. In some modes intermediate ticks are not generated, therefore the difference between the requested order price and the current price (Open or OHLC) can be significant. Execution of orders at the requested price in the "Open prices only" and "1 minute OHLC" provides more accurate testing results.

  4. Added support for forward testing in the visual mode. Now two separate windows are opened for back and forward testing, allowing users to compare Expert Advisor performance on different time intervals.




    The forward testing window is only opened after testing on the main period is completed.

  5. Now, instead of the margin level, the load on the deposit is displayed on the main testing chart. The load is calculated as the margin/equity ratio.


  6. Fixed calculation of commission as a percentage per annum during testing.

  7. Fixed calculation and display of balance on the chart generated in the process of testing.

MQL5

  1. The behavior of the OrderSend function during order placing, modification, and canceling has changed. The changes only apply to orders sent to external trading systems. In earlier version, OrderSend function control was returned after the order has been successfully placed (handled) on the broker's server. Now the control is only returned after the broker's server receives a notification from an external trading system notifying that the order has been successfully placed in that system.

    The below diagram shows the previous (red arrow) and current behavior of the function:




  2. A new field in the MqlTradeResult structure: retcode_external - an error code in the external trading system. The use and types of these errors depend on the broker and the external trading system, to which trading operations are sent. For example, retcode_external values filled by Moscow Exchange differ from those returned by DGCX.

  3. New properties in the ENUM_CHART_PROPERTY_STRING enumeration: CHART_EXPERT_NAME and CHART_SCRIPT_NAME. Now, the ChartGetString function allows users to find out the name of an Expert Advisor and/or script attached to a chart which is defined by the chart_id parameter.

Signals

  1. Fixed occasional error, due to which copying of the 'close by' operation could fail.
  2. Improved automated matching of currency pairs containing RUB and RUR.

Market

  1. Fixed sorting by product category.

MetaEditor

  1. Fixed setting of focus in the replace text field when opening a replace dialog box.
  2. Fixed replacing of multiple text occurrences when you search upwards starting from the current positions.


Updated documentation.