Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New version of MetaTrader 5 build 2190 platform

MetaQuotes Software Corp. , 2019.11.12 15:28

Released beta 2208:

  • fix loading expert profiles
  • fixed display of payment methods in the VPS tab

You can update via the Help menu -> Check for Updates.


Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New Graphics Capabilities in MQL5 with Direct Access to DirectX 11

MetaQuotes Software Corp. , 2019.11.22 11:30

November 27, 2019 we will release a build with new graphic capabilities for building complex 3D visualizations.

We offer to see a demonstration:


An example in the form of an ex5 file can be run on the current beta version 2224, available by the Help -> Check for Updates command.


Forum on trading, automated trading systems and testing trading strategies

New Graphics Capabilities in MQL5 with Direct Access to DirectX 11

Renat Fatkhullin , 2019.11.22 12:12

This is the new CCanvas3D class that extends the capabilities of CCanvas.

We have added a ton of native DirectX 11 methods in MQL5 so that you can visualize complex models in 3D projections.


In the release, native work with SQLite SQLite in MQL5 will most likely also be available, if we have time. This will greatly simplify the work with massive data and make quick selections.


Files:
Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New Graphics Capabilities in MQL5 with Direct Access to DirectX 11

Renat Fatkhullin , 2019.11.24 20:10

There is no need to worry about the size of the terminal - it is very compact and integral within its capabilities.

We added DirectX to enable the creation of a new class of programs. Powerful and more professional due to high-quality visualization.

SQLite will dramatically simplify work with massive and heterogeneous data. No need to deal with primitive file bindings, just save to the database.


We go further:

  1. We add Clang / LLVM support for C / C ++ to the editor to compile DLL / EXE projects locally



  2. More importantly, we are opening a new class of programs in the form of modules written in C / C ++ and safely converted to EX5

    It will be possible to compile existing libraries in EX5 with minor corrections. All potentially dangerous api calls will be replaced by MQL5 controlling wrappers.



  3. We add Python support to make it easy to run python scripts from the editor to generate / process data for MQL5

  4. We expand the detailed settings of commissions and slips of the tester in addition to the symbol settings already redefined in beta

  5. We reduce resource costs and the very scheme of delivering historical data to local agents


Something will be available in the release on November 27, and the rest in the next beta and releases.



Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New Graphics Capabilities in MQL5 with Direct Access to DirectX 11

Renat Fatkhullin , 2019.11.25 20:13

Build 2228 Available:


Now, such visualizations are easily done directly in MQL5 using the standard CCanvas3D library.


Files:
Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform beta build 2245: DirectX functions for 3D visualization in MQL5 and symbol settings in Strategy Tester

MetaQuotes Software Corp., 2019.11.29 13:41

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

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


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

The new version features the following changes:

  1. Terminal: More columns have become available in Market Watch. The main section now features 40 additional symbol parameters, which were previously available only under the Details tab.




  2. Terminal: Added highlighting of the currently connected account and the current server in the Navigator. The function will be useful if you have multiple accounts with different brokers.




  3. Terminal: Updated frame design for charts. Frames have become smaller and thus more space is now available for useful information.




  4. Terminal: Modified algorithm for calculating trading totals when displaying the trading history as positions. The values are now calculated based on actual records.

    To display the trading history as positions, the terminal uses information about deals executed during the requested period. Only the positions closed within this period will be shown in history. If the position is still open or its close time does not fall within the selected interval, it will not be displayed in history. Therefore, the total profit and commission in the 'positions' mode can differ from those in the 'orders/deals' history mode.

    For example, you are viewing the past week history. During this period, 100 deals were executed, 98 of which opened and closed 20 positions. The last two deals opened new positions, which have not been closed up to now. In this case, the history of deals contains 100 records and appropriate total values calculated based on these deals. When viewing the history as positions, you will see 20 records collected based on 98 deals. Only this data will be taken into account when calculating total values. If the broker charges entry deal fees, the final commission value in the deals history will differ from the commissions shown in the positions history, because two last deals will be ignored in case latter case.

  5. Terminal: Implemented faster launch of MQL5 programs.
  6. Terminal: New /beta key has been added for the terminal installation file, which allows downloading the beta version. In normal mode, the release version should be installed first, which can then be updated till a beta version. By skipping this step, you can save time and traffic. Installation start example:
    C:\mt5setup.exe /beta
  7. Terminal: Fixed display of margin requirements for instruments with the "Exchange Stocks" type.
  8. Terminal: Accelerated operation of all platform components through the use of the Clang/LLVM compiler. In some cases compilation is 20% faster.
  9. MQL5: Added new DirectX 11 functions and shaders for 3D visualization. Now powerful three-dimensional graphics can be created directly in MQL5.

    The new CCanvas3D class is an extension of the CCanvas custom graphics class. It is available in the \MQL5\Include\Canvas\ directory. The class features functions for rendering three-dimensional objects via DirectX API.

    • Create — creates a scene.
    • Attach — binds a scene to a chart.
    • Destroy — destroys a scene.
    • ObjectAdd — adds to the scene a descendant object inherited from the base CDXObject class.
    • Render — the full render loop, with buffer clearing and rendering of all CDXObject, added via the ObjectAdd method.
    • RenderBegin — starts scene rendering, fills the render buffer with the specified color (if DX_CLEAR_COLOR flag is set) and the depth buffers (when using DX_CLEAR_DEPTH), as well as sets the DXInputScene scene buffer for default shaders.
    • RenderEnd — completes scene rendering and receives a result to an internal buffer. If redraw==true, displays the image on the chart, on which it is running.
    • ViewMatrixGet — receives a view matrix.
    • ViewMatrixSet — sets a view matrix. The matrix is not compatible with ViewPositionSet, ViewRotationSet, ViewTargetSet and ViewUpDirectionsSet methods.
    • ViewPositionSet — sets camera position.
    • ViewRotationSet — sets camera rotation matrix.
    • ViewTargetSet — sets the point the camera is pointing at. Together with ViewUpDirectionsSet, it is an alternative to ViewRotationSet.
    • ViewUpDirectionsSet — sets the vertical position of the camera. Together with ViewTargetSet, it is an alternative to ViewRotationSet.
    • ProjectionMatrixGet — received projection matrix.
    • ProjectionMatrixSet — sets projection matrix.

    Detailed documentation for the new library will be published soon.

    New function usage examples are available under \MQL5\Experts\Examples\:

    • CorrelationMatrix3D
    • DemoMorphMath3D

    Compile them and run on a chart to view the 3D visualization possibilities in MQL5.




  10. MQL5: Added support for operations with SQLite databases directly from MQL5. Connection to databases and execution of SQL queries can now be implemented using the MQL5 functions. The internal operation is implemented by the new standard library extension.

    The following functions are available:
     //--- opening and closing the database
      int  DatabaseOpen(string filename,UINT flags);
      void DatabaseClose(int database);
      
      //---  working with tables
      bool DatabaseTableExists(int database,string table_name);
    
      //--- preparing an SQL query
      int  DatabasePrepare(int database,string sql,...);
      void DatabaseFinalize(int request);
      
      //--- reading a query result without/with binding to MQL5 structure
      int  DatabaseRead(int request);
      int  DatabaseReadBind(int request,struct or var);
      
      //--- extracting data from query results to different data types
      int  DatabaseGetColumnCount(int request);
      int  DatabaseGetColumnSize(int request,int column);
      int  DatabaseGetColumnType(int request,int column);
      int  DatabaseGetColumnText(int request,int column,string &value);
      int  DatabaseGetColumnInteger(int request,int column,int &value);
      int  DatabaseGetColumnLong(int request,int column,long &value);
      int  DatabaseGetColumnDouble(int request,int column,double &value);
      int  DatabaseGetColumnBlob(int request,int column,void &data[]);
    
      //--- working with transactions
      int  DatabaseExecute(int db_id,string request);  
      int  DatabaseBeginTransaction(int db_id);
      int  DatabaseCommitTransaction(int db_id);
      int  DatabaseRollbackTransaction(int db_id);
  11. MQL5: Added new property of MQL5 programs, which enables the selection of a default visualization method.
    #property optimization_chart_mode "3d,InpX,InpY"
    The property allows setting the type of the chart that opens at the end of optimization, as well as program parameters for the X and Y axes.

    The property only sets the default chart view. It can be changed manually at any time, using the context menu.

  12. MQL5: New MathArctan2 function. Returns the radian value of the angle, the tangent of which is equal to the ratio of the two specified numbers.
    double  MathArctan2(
       double  y      // the y coordinate of the point
       double  x      // the x coordinate of the point
       );
  13. MQL5: We have performed the general optimization of programs to improve performance and reduce resource consumption.
  14. MQL5: Added examples of math calculations which can be performed in the strategy tester. They are available under the \MQL5\Experts\Examples\Math 3D\ directory.
  15. MQL5: Introduced tighter control of namespaces.
  16. MQL5: Added loading of linked libraries when using .NET libraries in MQL5 programs. If the used .NET library requires other libraries for operation, the compiler will try to download required libraries automatically from \MQL5\Libraries.
  17. MQL5: Fixed time operations in the MetaTrader module for Python integration. Now all output data use the time of the trading server to which the terminal is connected.
  18. Tester: A plethora of new features and improvements:


    Custom settings for financial instruments
    Now you can change settings of the main trading instrument, using which testing/optimization is performed. Almost all specification parameters can be overwritten: volumes, trading modes, margin requirements, execution mode and other settings. Thus, if you need to check an Expert Advisor under different conditions, there is no need to create a separate custom symbol and download its history. This can be done by changing standard symbol settings.



    If the symbol specification is customized, the gear icon and the symbol icon are marked with an asterisk. This shows that custom parameters are used for the current test.




    Last settings/Expert Advisors/charts
    Use the new context menu commands for fast testing or optimization setup. Choose the last used tester settings, recent charts or applications:




  19. MetaEditor: Added ability to compile C/C++ and Python projects directly from MetaEditor. Now, multi-lingual projects can be managed using the built-in editor.

    If appropriate compilers are installed on your PC, MetaEditor will detect them and add to settings. Optionally, you can specify paths to required components under the Compilers tab. From the same tab, you can download the components by clicking Install next to the appropriate field.



    After that you can compile C/C++ and Python projects similarly to MQL5 programs.

  20. MetaEditor: Added support for sub-projects inside the Shared Projects directory intended for shared project development via MQL5 Storage. Previously, only single projects could be created at the top level.
  21. MetaEditor: Built-in debugger updates.
  22. MetaEditor: Fixed addition of a function header when using a code styler.
  23. MetaEditor: 'Jump to previous/next cursor position' commands are now available not only in the View menu, but also on the toolbar.
  24. MetaEditor: Spaces can now be used in project names.
  25. Android: Added ability to quickly switch to deposit/withdrawal pages on the broker website.

    There is no need to search for appropriate functions in a trader's room on the broker site. Fast navigation commands are available directly in terminals: users can switch to deposit and withdrawal pages from the Accounts and Trading sections:



    • Deposit/withdrawal operations are only available if appropriate functions are enabled for the trading account on the broker side.
    • The trading terminal does not perform any account deposit/withdrawal operations. The integrated functions redirect the user to the appropriate broker website pages.
  26. Android: Positions in history are sorted now by closing date.
  27. Android: Added marking of positions closed by Stop Loss or Take Profit with red and green vertical lines in the history section.
  28. Android: Added new fields in the trading symbol specification:

    • Category — the property is used for additional marking of financial instruments. For example, this can be the market sector to which the symbol belongs: Agriculture, Oil & Gas and others. The category is displayed only if the appropriate information is provided by the broker.
    • Exchange — the name of the exchange in which the security is traded. The category is displayed only if the appropriate information is provided by the broker.

  29. Android: Added Margin Call state indication in the trading section. Upon the emergence of this state, Margin, Free Margin and Margin Level parameters are shown in red.
  30. Android: Fixed display of the OTP section opening button on tablets.
  31. Android: Other fixes and improvements.
  32. iPhone/iPad: Added ability to quickly switch to deposit/withdrawal pages on the broker website. For further details, please see the What's New list of MetaTrader 5 for Android.



  33. iPhone/iPad: Added dark mode support for iOS/iPadOS.
  34. iPhone/iPad: The one-time password section has become available in the iPad version.
  35. iPhone/iPad: The positions closed by Stop Loss or Take Profit are marked with red and green vertical lines in the history section.
  36. iPhone/iPad: Positions in history are sorted now by closing date. If the position has not yet been closed, its opening date is used for sorting.
  37. iPhone/iPad: Other fixes and improvements.
  38. Fixes based on crash logs.

The update will be available through the Live Update system.


Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

SQLite in MQL5: New Features and Performance Testing

Renat Fatkhullin , 2019.12.07 09:24

In build 2265, we implemented regular functions for working with databases based on SQLite 3.30.1:


Bases can be stored both on disk and only in memory using the DATABASE_OPEN_MEMORY flag . Wrapping massive inserts / changes in a DatabaseTransactionBegin / Commit / Rollback transaction speeds up operations hundreds of times.

Since we are focused on performance as much as possible, here are the results of LLVM 9.0.0 vs MQL5 tests. Time in milliseconds, the less the better:
Windows 10 x64, Intel Xeon  E5-2690 v3 @ 2.60GHz
                                                        LLVM   MQL5
---------------------------------------------------------------------------------
Test  1: 1000 INSERTs:                                 11572   8488
Test  2: 25000 INSERTs in a transaction:                  59     60
Test  3: 25000 INSERTs into an indexed table:            102    105
Test  4: 100 SELECTs without an index:                   142    150
Test  5: 100 SELECTs on a string comparison:             391    390
Test  6: Creating an index:                               43     33
Test  7: 5000 SELECTs with an index:                     385    307
Test  8: 1000 UPDATEs without an index:                   58      54
Test  9: 25000 UPDATEs with an index:                    161    165
Test 10: 25000 text UPDATEs with an index:               124    120
Test 11: INSERTs from a SELECT:                           84     84
Test 12: DELETE without an index:                         25     74
Test 13: DELETE with an index:                            70     72
Test 14: A big INSERT after a big DELETE:                 62     66
Test 15: A big DELETE followed by many small INSERTs:     33     33
Test 16: DROP TABLE: finished.                            42     40

The speed in MQL5 is absolutely the same as in native C ++ with one of the best compilers. A benchmark package for playback is attached.


We also implemented the unique DatabaseReadBind function, which allows you to read records directly into the structure, which simplifies and speeds up bulk operations.

Here is a simple example:

 struct Person
  {
   int                id;
   string             name;
   int                age;
   string             address;
   double             salary;
  };

//+------------------------------------------------------------------+
//| Test                                                             |
//+------------------------------------------------------------------+
bool TestDB( string filename, int flags)
  {
   int db;
//--- open
   db=DatabaseOpen(filename,flags);
   if (db== INVALID_HANDLE )
     {
       Print ( "DB: " ,filename, " open failed with code " , GetLastError ());
       return ( false );
     }
//--- create a table
   if (!DatabaseTableExists(db, "COMPANY" ))
       if (!DatabaseExecute(db, "CREATE TABLE COMPANY("
                           "ID INT PRIMARY KEY     NOT NULL,"
                           "NAME           TEXT    NOT NULL,"
                           "AGE            INT     NOT NULL,"
                           "ADDRESS        CHAR(50),"
                           "SALARY         REAL );" ))
        {
         Print ( "DB: " ,filename, " create table failed with code " , GetLastError ());
         DatabaseClose(db);
         return ( false );
        }
//--- insert data
   if (!DatabaseExecute(db, "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (1, 'Paul', 32, 'California', 20000.00 ); "
                       "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (2, 'Allen', 25, 'Texas', 15000.00 ); "
                       "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (3, 'Teddy', 23, 'Norway', 20000.00 );"
                       "INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY) VALUES (4, 'Mark', 25, 'Rich-Mond ', 65000.00 );" ))
     {
       Print ( "DB: " ,filename, " insert failed with code " , GetLastError ());
      DatabaseClose(db);
       return ( false );
     }
//--- prepare the request
   int request=DatabasePrepare(db, "SELECT * FROM COMPANY WHERE SALARY>15000" );

   if (request== INVALID_HANDLE )
     {
       Print ( "DB: " ,filename, " request failed with code " , GetLastError ());
      DatabaseClose(db);
       return ( false );
     }
//--- выводим записи
   Person person;

   for ( int i= 0 ; DatabaseReadBind(request,person); i++)
       Print (i, ":  " ,person.id, " " , person.name, " " ,person.age, " " ,person.address, " " ,person.salary);

   Print ( "" );
//--- close all
   DatabaseFinalize(request);
   DatabaseClose(db);
   return ( true );
  }

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart ()
  {
   TestDB( "test.sqlite" ,DATABASE_OPEN_READWRITE | DATABASE_OPEN_CREATE |DATABASE_OPEN_COMMON);
  }


Output:
0 :   1 Paul 32 California 20000.0
1 :   3 Teddy 23 Norway 20000.0
2 :   4 Mark 25 Rich-Mond   65000.0 




Forum on trading, automated trading systems and testing trading strategies

New version of the MetaTrader 5 platform build 2265: DirectX functions for 3D visualization in MQL5 and setting up tools in the strategy tester

Renat Fatkhullin , 2019.12.07 08:28

Look at the new features of 3D graphics with examples in release 2265:

  • / include / canvas - lots of functions for DirectX
  • / experts / examples / Correlation Matrix 3D
  • / experts / examples / Math 3D Morph
  • / scripts / examples / Remnant 3D

And a set of functions for working with SQLite databases .


Files:
SqLiteTest.zip  2709 kb
Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

Some tools do not work with new 2265 build of MT5 - how to fix?

Aytugan Khafizov, 2019.12.09 17:30

We released a MT5 terminal beta-version with fix for ticksize and StringTrim issues.

Please open demo account on MetaQuotes-Demo server to download update

And provide us with feedback.

Sergey Golubev
Moderator
122313
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 Platform Build 2280

MetaQuotes Software Corp., 2019.12.12 15:54

The MetaTrader 5 platform update will be released on Friday, December the 13th, 2019. The update features important additions and fixes based on the feedback we have received after the previous MetaTrader 5 build 2265 major update:

  1. Terminal: Fixed a bug which caused inability to delete an Expert Advisor from the chart having no data.
  2. Terminal: Fixed chart header display under Wine.
  3. MQL5: Improved loading and compilation speed of MQL5 programs.
  4. MQL5: A double click on a chart is now passed as a single-click event to an MQL5 program. Previously, such events were not handled.
  5. MQL5: Fixed StringTrimRight function operation.
  6. Tester: Fixed a bug which cased the testing symbol in settings to be empty. The error could result from switching between trading accounts with different sets of trading instruments. The new behavior: if the previously selected symbol is not found in the currently connected trading account, the first available symbol In Market Watch is automatically selected instead.
  7. MetaEditor: Fixed application icon loading when reopening project properties.
  8. Added documentation for DirectX 3D visualization functions.
  9. Updated user interface translations.
  10. Fixes based on crash logs.

The update will be available through the Live Update system.

We strongly recommend to install this update.

Sergey Golubev
Moderator
122313
Sergey Golubev  

OpenCL


The forum

CodeBase

      The articles

        The blogs

          The documentation

              The market

              • many in search here

              Taking Neural Networks to the next level
              Taking Neural Networks to the next level
              • 2019.11.29
              • www.mql5.com
              This thread won't be about a question or problem, but rather about the anouncement of the presentation and documentation of an exciting trading con...
              Sergey Golubev
              Moderator
              122313
              Sergey Golubev  

              Extending Strategy Builder Functionality - the article 

              Table of Contents Introduction

              In the first part of the article series, we analyzed Merrill patterns and applied them to different data arrays, such as the price and price-based oscillators ATR, CCI and WPR, among others. The purpose of the article was to explore and evaluate the prospects of using the specified patterns on forex and other markets. The second part was devoted to the creation of a Strategy Builder to assemble simple strategies using the previously discussed patterns. In the third part, we will expand the strategy creation and testing functionality. We will add the possibility to work with lots in addition to points, as well the functionality for viewing testing results.


              Extending Strategy Builder Functionality
              Extending Strategy Builder Functionality
              • www.mql5.com
              In the first part of the article series, we analyzed Merrill patterns and applied them to different data arrays, such as the price and price-based oscillators ATR, CCI and WPR, among others. The purpose of the article was to explore and evaluate the prospects of using the specified patterns on forex and other markets. The second part was...