New MetaTrader 5 platform build 4260: General improvements

 

The MetaTrader 5 platform update will be released on Friday, March 22, 2024.

The new version enhances keyboard event handling capabilities in MQL5 programs. Developers can now capture key release and dead key events, improving interaction between applications and users.

The MetaEditor has introduced a new search option to assist users in navigating through the contents of the recently released book Neural Networks for Algorithmic Trading in MQL5. The web platform update provides fixes to limit setting procedures for exchange instruments.



MetaTrader 5 Client Terminal

  1. Terminal: Fixed errors in subscribing to free products in the Subscriptions service. The relevant button might not be displayed in the dialog under certain conditions.
  2. Terminal: Updated translations of the user interface.
  3. MQL5: Expanded support for keyboard events:

    • Added CHARTEVENT_KEYUP event for the OnChartEvent handler. It allows the tracking of events related to key releases.
    • Added processing of Dead keys. These are the keys that modify the appearance of the character generated by the key struck immediately after. For example, in the Greek layout, a stressed vowel ά, έ, ύ, etc., can be generated by first pressing ";" and then the vowel. The pressing of such keys can be tracked using the TranslateKey function.
    • Improved TranslateKey and TerminalInfoInteger functions. Now, when receiving CHARTEVENT_KEYUP or CHARTEVENT_KEYDOWN events in OnChartEvent, you can obtain the complete keyboard state at the time the event occurred. For example, if the user pressed the Z key, you will be able to determine whether the Ctrl or Shift key was pressed at that moment. For other events, the functions will continue to operate as before, returning the keyboard state at the current moment.

  4. MQL5: Updated the Alglib library. Following the update, the following methods in the CMatrixDouble and CMatrixComplex classes have been modified:
    vector<double/complex> operator[](const int i) const;
    vector<double/complex> operator[](const ulong i) const;
    They have been replaced by a single method with a constant return value:
    const vector<double/complex> operator[](const ulong i) const;
    This modification will assist in capturing incorrect use of the result in place as in the new Alglib version, the code mat[row][col]=x operates differently from the old version. Previously, this indicated writing to a matrix. Now, the value is written to a temporary object vector<double/complex>, which is immediately destroyed after recording.

    Adding const to the return value enables the use of mat[row][col]=x. Because mat[row] now returns a constant vector, attempting to overwrite its element with mat[row][col] will result in a compilation error.

  5. MQL5: Fixed error that could cause the incorrect operation of ChartGet* functions under certain conditions.
  6. MetaEditor: Added search through the contents of the book Neural Networks for Algorithmic Trading in MQL5. The new option appears in the same section as the previously published book MQL5 Programming for Traders.



  7. Tester: Fixed optimization when using a large number of remote agents. In some cases, the error could cause excessive CPU usage.
  8. Fixed errors reported in crash logs.

MetaTrader 5 Web Terminal

  1. Fixed setting of limit orders for instruments with the exchange execution mode. Now, when the price of the order being placed changes relative to the current price (becomes higher or lower), the order type will not switch from Buy Limit to Sell Limit and vice versa, as it does for instruments of other types. Thus, users can place Buy Limit orders above the market and Sell Limit orders below the market, ensuring that the transaction price is guaranteed to be limited.
  2. Fixed the display of selected symbol counters in the Market Watch.

The update will be available through the Live Update system.

 


Hello.

There is a problem with transferring files to VPS MQL.

I am creating a file to transfer global variables from the current terminal.

 #define defGlobalName "ALL_GLOBAL2024.csv"
 #property tester_file defGlobalName

 bool GlobalVariableToFileSet( string path)
  {
   string buffer= GlobalVariablesTotal ();
   int Handle;
   string File_Name=path;       
   ResetLastError ();
   Handle= FileOpen (File_Name, FILE_CSV | FILE_WRITE );
   int FileError= GetLastError ();

   if (Handle== INVALID_HANDLE ) 
     {
       if (FileError== 4103 || FileError== 5004 || FileError== 5020 ) 
        {
         PrintToLogs( "File Error " +FileError);
         return ( false );                       
        }
       else 
         if ( GetLastError ()!= 0 )
           {
             return ( false );
           }
     }
   FileWrite (Handle,buffer);
   string buffer2= "" ;
   for ( int i= 0 ; i< GlobalVariablesTotal (); i++)
     {
       FileWrite (Handle, GlobalVariableName (i));
       FileWrite (Handle, GlobalVariableGet ( GlobalVariableName (i)));
     }
   FileClose (Handle);               
   return ( true );
  }

When synchronizing with VPS MQL, the file is transferred normally the first time. All global variables are read normally.


But. When changing global variables and new synchronization of the same file -

ERROR. The new file is not transferred to the server. All old data (from old global) is read.

if i change name  then (When synchronizing with VPS MQL, the file is transferred normally the first time. All global variables are read normally.)
#define defGlobalName "ALL_GLOBAL20242.csv"


I read it the same way:

 bool GlobalVariableToFileGet( string path)
  {
   long Handle;
   string File_Name=path;      
 //--------------------------------------------------------------- 3 -- 
   Handle= FileOpen (File_Name, FILE_CSV | FILE_READ | FILE_SHARE_READ , ";" );
   int FileError= GetLastError ();
   if (Handle< 0 ) // Неудача при открытии файла 
     {
       if (FileError== 4103 || FileError== 5004 || FileError== 5020 )
         return ( false );
       else 
         PrintToLogs( "error " +File_Name+ " " +FileError+ " File not ready" );
       return ( false );
     }
   int TotalVar= FileReadString (Handle);
   PrintToLogs( "GlobalVariableToFileGet from" +File_Name+ " TotalVar=" +TotalVar);
   for ( int i= 0 ; i<TotalVar; i++)
     {
       string nameGlobal= FileReadString (Handle);
       string valueGlobal=( FileReadString (Handle));
       if (nameGlobal!= "" && valueGlobal!= "" )
         GlobalVariableSet (nameGlobal, StringToDouble (valueGlobal));
     }
   FileClose (Handle);                 // Закрываем файл 
   return ( true );
  }


The same thing happens with global variables.

New global variables are not transferred during synchronization.

I have already removed all global variables.

But the old glob variables still hang on the server.

And they are not deleted.


I added an output of the date of the last modification of the file, and here you can see that there is already a new file on the computer, but there is still an old file on the server (which was downloaded back)





Needed for the panels to work on the server MQL.

Thank you.

 
When I press the Stop button, the Deinit function is not called? 
That is, the testing is rigidly terminated. 
I am used to the report not being generated. That's why I want to form my report on the visualization chart. But the deinit function is not called when pressing the STOP button. 
 
It would be really nice if Metaquotes listened to their userbase for improvements, such as code folding for example.  That has been requested for many years, yet, other feature are constantly added that very few people actually use...
 

After updated to 4260 MessageBox() always return 0 whether Yes or No is selected.

int mb_id = ::MessageBox(Msg, SCANNER_NAME, MB_YESNO|MB_ICONQUESTION);
printf(mb_id);
 
Nguyen Van Luong #:

After updated to 4260 MessageBox() always return 0 whether Yes or No is selected.

I checked. Everything works fine with MessageBox .

 

Strategietester with local agents works very very slow after update to 4260. It's not usable!!.

In my test case I used to option to test the expert with all Symbols and the the list. Ok, it use less CPU - but all performance was lost!!!! 

 
4info #:

Strategietester with local agents works very very slow after update to 4260. It's not usable!!.

In my test case I used to option to test the expert with all Symbols and the the list. Ok, it use less CPU - but all performance was lost!!!! 

I'm having this problem since the version 4230. In my case each agent is using too much memory draining out everything until start to bottleneck the cpu. Sometimes it crashes the desktop and I need to sign in again. 

My account is in USD and I noticed that when I test a pair where the last currency is USD (xxxUSD) I have no problem, the cpu goes to 100% and the memory stays around 40% which is nornal in any other pair I have the problem. 

I'm unable to use mt5 for 2 weeks now due this problem.

I've read on old posts that they had some problem with mt5 and AMD processors, I wonder if this problem is back.


I have a AMD Threadripper 3995wx Pro 256GB Ram with Win 11 and Win 10.

 
Vladislav Andruschenko #:

I checked. Everything works fine with MessageBox .

int mb_id = ::MessageBox("Try choosing Yes.", "Test", MB_YESNO|MB_ICONQUESTION);
bool bStartEA = (mb_id == IDYES);
if (bStartEA)
{

    printf("Selected Yes!");
}

Please re-complie and check again. After updated to 4260,  I selected Yes of MessageBox() but can not excute "printf("Selected Yes!");"

 
Nguyen Van Luong # :

Please re-complie and check again.  After updated to 4260,  I selected Yes  of MessageBox() but can not excute " printf("Selected Yes!");"


I'm using my own code (simple).

and everything works as standard for me.

if(MessageBox("Do you really want to Close ALL Positions and Orders in This EA, opened with EA?","Close ALL",MB_YESNO|MB_ICONQUESTION)==IDYES)
            CheckPressedOpen=true;
 
Vladislav Andruschenko #:


I'm using my own code (simple).

and everything works as standard for me.

I used MessageBox() in a Services project. If Remove Service and Add Service again then MessageBox() works. But Stop and Start again then MessageBox() not works. Both for your code and mine.

Reason: