MetaTrader 5 platform beta build 2055: Integration with Python and Strategy Tester improvements

 

The beta version of the updated MetaTrader 5 platform will be released on Friday, May 17, 2019. We invite traders to join the new version testing in order to evaluate updated platform features and to help developers fix errors.

To update the MetaTrader 5 platform up to build 2055, navigate to Help \ Check Desktop Updates \ Latest Beta Version:


The final build of the new MetaTrader 5 platform will be released after the public beta testing.


MetaTrader 5 Client Terminal build 2055

  1. Terminal: Added new API enabling request of MetaTrader 5 terminal data through applications using the Python language.

    Python is a modern high-level programming language for developing scripts and applications. It contains multiple libraries for machine learning, process automation, as well as data analysis and visualization.

    MetaTrader package for Python is designed for efficient and fast obtaining of exchange data via interprocessor communication directly from the MetaTrader 5 terminal. The data received this way can be further used for statistical calculations and machine learning.



    Connection

    1. Download the latest Python version at https://www.python.org/downloads/windows
    2. During Python installation, check "Add Python X.X to PATH%" to enable launch of Python scripts from the command line.
    3. Install the MetaTrader 5 module from the command line
      pip install MetaTrader5
    4. Add matplotlib and pytz packages
      pip install matplotlib
      pip install pytz

    Functions

    • MT5Initialize establishes connection with the MetaTrader 5 terminal
    • MT5Shutdown closes the previously established connection to the MetaTrader 5 terminal
    • MT5TerminalInfo gets status and parameters of the connected MetaTrader 5 terminal
    • MT5Version returns the MetaTrader 5 terminal version
    • MT5WaitForTerminal waits till the MetaTrader 5 terminal connects to the trade server
    • MT5CopyRatesFrom gets bars from the MetaTrader 5 terminal starting from the specified date
    • MT5CopyRatesFromPos gets bars from the MetaTrader 5 terminal starting from the specified index
    • MT5CopyRatesRange gets bars in the specified date range from the MetaTrader 5 terminal
    • MT5CopyTicksFrom gets ticks from the MetaTrader 5 terminal starting from the specified date
    • MT5CopyTicksRange gets ticks for the specified date range from the MetaTrader 5 terminal


  2. Terminal: The Market and Signal sections have been optimized. Now the product and signal showcases run up to seven times faster and thus provide better service browsing experience.




  3. Terminal: Added support for "Market", "Signals" and "Search" in Wine. Linux and Mac OS users can now access the largest store of trading applications and the copy trading service.




  4. Terminal: The built-in learning program has been translated into more than 30 languages, including Spanish, Chinese, Portuguese and German. To view interactive tips in the desired language, switch the interface language using the View menu.




  5. Terminal: New options enable verification of phone numbers and emails which traders specify when opening demo and preliminary accounts.

    The need for data verification is determined by the broker. If the option is enabled, confirmation codes are automatically sent to the trader during account request and special code fields appear in the dialog box:




    Confirmation codes are valid for several minutes. If the code is not entered in the field within this time, the trader will need to repeat the procedure.

    Before sending codes, the system checks whether the specified phone/email was previously confirmed. If the trader has already passed verification from his or her computer, account will be opened without additional confirmation. Thus, there will be no additional difficulties for traders during account request.

  6. Terminal: MQL5.community payment options through the PayPal system have been expanded. Purchases can now be performed with one click using this system.

    How it works
    After you authorize with your PayPal account when making a purchase, you will be asked to allow further payments to our company:





    Confirm this option, and you will be able to perform further purchases with one click, by pressing the previously saved account button:




    If you click "Cancel and return to MetaQuotes Software Corp.", you will make payments in a normal way by entering PayPal account details manually for each purchase.
    The MQL5.com website and the MetaTrader 5 platform do not store your payment details. In the case of tot-up, Market purchases or Signal subscriptions, the data verification is performed on the payment system side.
    You can always remove your PayPal account link.

  7. Tester: Strategy Tester improvements and optimization.

    We have introduced a large number of hidden improvements and fixed errors to optimize the Strategy Tester operation. The update enables much faster testing of some of the task types and higher operation stability. Major improvements include:

    Operations with frames
    Operations with frames on local, network and cloud agents have been optimized. Such operations are now processed faster and are never skipped.

    Distribution of tasks to agents
    The tester can now redistribute tasks to agents during the optimization process. If a new agent has become available (or one of the previously used ones has been released), the tester automatically creates a new package of tasks using those which were earlier distributed among other agents. Tasks can also be redistributed if slow agents are detected. Tasks of such agents are sent to other agents to complete the optimization faster.

    Task distribution in math calculation mode has become mush faster.

    Optimization statistics in the Journal
    Optimization logging has been extended: it includes detailed statistics related to the MQL5 Cloud Network use, to enabling and disabling of cloud agents, among others.

    Operation in full optimization log mode
    For optimal resource consumption, not all messages from agents are written to the tester log. To display all logs, you can enable the "Full optimization logs" option using the tester log context menu. Previously, this mode significantly slowed down the optimization process. Now the calculation time is not affected.

    MQL5 Cloud Network
    Optimized operation of cloud testing agents. Now computation tasks are distributed more efficiently.

  8. Terminal: The built-in calendar features publications of more than 900 indicators related to 18 largest global economies, including US, European Union, Japan and UK, among other. Relevant data is collected from open sources in real time. By regularly checking the service, traders remain informed on the latest global news and can make informed trading decisions.

    The economic calendar is available in desktop terminals and websites, as well as on mobile devices. The application can be opened using the Calendar context menu in the terminal:




    Select your platform and download the Tradays apps:


    In addition to calendar functions available in the desktop platform, the mobile version provides event reminders and access to a complete history of indicators in the form of charts and tables.

  9. Terminal: Added automatic generation of custom symbol bar history during import of tick history. Now, if tick data of a custom symbol changes, corresponding bars are automatically recalculated:

    • Thus unified data is preserved in the platform.
    • After importing tick data (provided that there is enough data), there is no need to import bars, while they are automatically calculated by the terminal.

    Changes concern import of ticks performed via the terminal interface, as well as the update of ticks performed from MQL5 applications using the CustomTicks* function. Any changes in tick data lead to recalculation of corresponding 1-minute bars of the custom symbol.

  10. Terminal: Fixed data update in the Data Window when using a crosshair on a detached chart.
  11. Terminal: Fixed tick history saving. In earlier versions, multiple ticks within a millisecond could be saved in a wrong order.
  12. Terminal: Fixed generation of charts based on a too short price history (less than a day) available on the server.
  13. MQL5: Added MQL5 service debugging option. These applications can now be tested using real and historical data, similarly to Expert Advisors and indicators.
  14. MQL5: During the OnDeinit method execution, the MQL5 application does not receive any events from the terminal. Previously, applications occasionally failed to complete de-initialization (for example, to delete all created objects) due to receiving other events.
  15. MQL5: Fixed occasional errors which could occur after a change in the custom symbol tick history for the current day.
  16. MQL5: Fixed occasional application slowdown when using a large number (tens of thousands) of graphical objects.
  17. MQL5: Fixed terminal freezing in case of frequent trading history calls from MQL5 programs.
  18. MQL5: Fixed iBarShift function operation. With the "exact=false" flag and request outside the data, the function returned the oldest bar number instead of the newest one.
  19. Tester: Fixed determination of the cores number on computers with processors having several NUMA nodes.
  20. MetaEditor: The code styler command can now be added to the toolbar for quick access.
  21. MetaEditor: Fixed switching to parameter definition and viewing of related data when using non-Unicode characters in function and variable names.
  22. Documentation has been updated.

The update is available through the LiveUpdate system.

 

On the preamble of one of my EA, there is the following line:

sinput datetime CompileTime      = __DATETIME__;// Compile datetime
It does not update it's display on Strategy Tester. Is it a bug?
 
Build 2045 strange behavior of Tester
Build 2045 strange behavior of Tester
  • 2019.05.24
  • www.mql5.com
Under following circumstances StrategyTester does not recognize a final version: From MetaEditor I start the Tester with Ctrl+F5(or Button) Tester...
 
Arthur Albano:

On the preamble of one of my EA, there is the following line:

It does not update it's display on Strategy Tester. Is it a bug?
There is nothing to update, it's the compilation time.
 

I found an issue with the TimeCurrent call within the Strategy Tester (This never happens on the live charts)

At the beginning of each bar the TimeCurrent is up to 30 seconds behind the time of the new bar (which means it isn't being kept up to date with the latest simulated time event)

#property strict
#property indicator_chart_window
#property indicator_plots 0

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
#ifndef __MQL4__
   ArraySetAsSeries(time, true);
#endif

   if (TimeCurrent() < time[0])
   {
      Print("WARNING  TimeCurrent()=", TimeCurrent(), " is less than time[0]=", time[0]);         
   }
   return rates_total;
}


2019.05.29 09:33:31.229 2019.05.27 01:30:00   WARNING  TimeCurrent()=2019.05.27 01:29:30 is less than time[0]=2019.05.27 01:30:00

2019.05.29 09:33:31.229 2019.05.27 02:00:00   WARNING  TimeCurrent()=2019.05.27 01:59:59 is less than time[0]=2019.05.27 02:00:00


This wasn't an issue a year ago. This regression may have been introduced in the Feb 2019 release

 

Regarding to 1. Terminal: Added new API enabling request of MetaTrader 5 terminal data through applications using the Python language.

@MetaQuotes Software Corp.

Is there any plans to develop more functions and features for python api? Eg. trading? Now is just acess to the feed. Or this is all what we can have?


Why @MetaQuotes Software Corp. doing some new API and not emulating the curent MQL4/5 API? Eg.

from MetaTrader5 import *
from MetaTrader5 import Trade.PositionInfo
from MetaTrader5 import Trade.Trade
from MetaTrader5 import ctp as MT5
from MetaTrader5 import Feed 

ot = MT5.Trade.OrdersTotal()

for x in ot:
        Trade.Trade.OrderSelect(x,SELECT_BY_POS,MODE_TRADES)

open = Feed.Symbol("EURUSD").open[1]
Print(open) 
Welcome to Python.org
Welcome to Python.org
  • 2019.05.28
  • www.python.org
The official home of the Python Programming Language
 
James Cater:

I found an issue with the TimeCurrent call within the Strategy Tester (This never happens on the live charts)

At the beginning of each bar the TimeCurrent is up to 30 seconds behind the time of the new bar (which means it isn't being kept up to date with the latest simulated time event)


2019.05.29 09:33:31.229 2019.05.27 01:30:00   WARNING  TimeCurrent()=2019.05.27 01:29:30 is less than time[0]=2019.05.27 01:30:00

2019.05.29 09:33:31.229 2019.05.27 02:00:00   WARNING  TimeCurrent()=2019.05.27 01:59:59 is less than time[0]=2019.05.27 02:00:00


This wasn't an issue a year ago. This regression may have been introduced in the Feb 2019 release

Can this be related to tester_everytick_calculate ?

 

Why we can't remove from top belt the "Search icon", "MQL5 Community link", "Acheviements" ?

It wasting workspace in case that are not used and need in laptop for more tools.

The mt4 and mt5 after some updated changed the charts resolutions as the spearation_betwen_bars = 0 pixels in some cases, where should be some blank space from background, and should be spearation_betwen_bars = 2 maybe. I know about zoom, but this not resolving problem - the zoom is to big in 3 step, the step 2 is perfect just cant be spearation_betwen_bars = 1 as near 0.
 
Alain Verleyen:

Can this be related to tester_everytick_calculate ?

I tried this setting, but it made no difference

tester_everytick_calculate is forcibly enabled in "Visual Mode". You may have noticed that "Visualisation" is automatically selected when testing indicators, so I doubt the optimization is in play

It's possible the code changes for tester_everytick_calculate were responsible for this regression, but that's just a guess

 
James Cater:

I tried this setting, but it made no difference

tester_everytick_calculate is forcibly enabled in "Visual Mode". You may have noticed that "Visualisation" is automatically selected when testing indicators, so I doubt the optimization is in play

It's possible the code changes for tester_everytick_calculate were responsible for this regression, but that's just a guess

Ok thanks. I will report your issue on Russian forum.
 
Thank you so much
Reason: