New MetaTrader 5 Platform Build 2340: Managing account settings in the Tester and expanded integration with Python
I've just updated to MetaTrader 2340 and I noticed that it broke custom DLL loading in Strategy Tester. I have an EA that uses a custom DLL and it stopped working because the Strategy Tester is unable to load the DLL. Before version 2340, everything was working properly
I wrote a simple EA with a test.dll to reproduce this error. The test DLL exports only one function, which is "void __stdcall test(int & x)".
#property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #import "TestDLL.dll" void test (int& x); #import //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- int p = 0; test(p); Print (p); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //---
Here is the DLL code:
#define _DLLAPI extern "C" __declspec(dllexport) _DLLAPI void __stdcall test(int & x) { x = 25; return; } BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
How to solve this issue? I attached the sample project to this post.
Thanks

- www.mql5.com
I haven't been able to use MT5's strategy tester properly for a long time.
Before today, I was able to use the 2280 version on my local CPU core and get the correct results.
So for a long time I had to wait patiently for optimizations to be done on the local computer while a lot of computing power deployed on the LAN was wasted.
I'm so hoping that metaquotes fixes bugs in the new release version, making the strategy tester a tool that at least works.
And today I finally got version 2340.
Then I found out that even the optimizations tasks on the local CPU core were not getting the right results!
I haven't been able to use MT5's strategy tester properly for a long time.
Before today, I was able to use the 2280 version on my local CPU core and get the correct results.
So for a long time I had to wait patiently for optimizations to be done on the local computer while a lot of computing power deployed on the LAN was wasted.
I'm so hoping that metaquotes fixes bugs in the new release version, making the strategy tester a tool that at least works.
And today I finally got version 2340.
Then I found out that even the optimizations tasks on the local CPU core were not getting the right results!
Reply from Russian forum thread - post #626
(just in case someone else is interested)
Forum on trading, automated trading systems and testing trading strategies
MetaTrader 5 Strategy Tester: errors, bugs, suggestions for improving the work
fxsaber , 2020.02.22 11:16
The last few pages in this thread are dedicated to this issue. Yesterday, the developers managed to reproduce this bug, and they are engaged in its elimination.
Dear MetaQuotes Software Corp.!
I make software development and I want to make a report about an error issue with the MQL5 programming language. Please submit my report to the MetaTrader 5 and MQL5 software developer team! Many thanks for considering my request! The following code is not compilable and the preprocessor and the compiler do not operate as the programmers expect. The code example is the following.
#define p_paste(arg_0, arg_1, arg_2) arg_0##arg_1##arg_2 #define p_evaluate_paste(arg_0, arg_1, arg_2) p_paste(arg_0, arg_1, arg_2) #define apple 11 #define mouse 12 #define table 13 void f() { int i = 10 + p_evaluate_paste(apple, mouse, table); PrintFormat("%d\n", i); return; }
This code is not compilable. The compiler error message is: "'111213' - undeclared identifier". This is not an identifier but just an integer literal. This does not have to be a valid identifier token. This is an obvious error of the implementation of the preprocessor. With GNU CPP this kind of programming constructions are compilable. I have a huge and bigger and bigger MQL5 software framework for my trading system and I could not compile some of my solutions with concatenating just an `arg_type' and a `&' to create a plain reference variable for objects. Please fix this issue ASAP! Many thanks for considering my request! Please, please, finish the implementation of the multiple inheritance from interfaces facilities ASAP! This is important for the future achievements. MetaTraders are otherwise excellent products and I have installed 250 instances in my virtual machine of the MetaTrader 5 client application. I would like to operate serious trading with your and my softwares.
Yours faithfully and best wishes: László Müller (voyevoda), Dombóvár, Hungary.

- www.mql5.com
It seems that when starting the test (i.e. by clicking "Start" in the Strategy Tester), the Tester agent is not copying the required files (including the DLL) to its internal MQL\Libraries folder. I've identified two events:
If I have a "Test.dll" file in my EAm then
1) Strategy Tester complains that the Test.dll.ex5 file is not found
2) The Test agent does not copy Test.dll to its internal folder and thus, the Strategy Tester complains that Test.dll cannot be found
%appdata%\Roaming\MetaQuotes\Tester\<MT5 ID>\Agent-127.0.0.1-3000\MQL5\Libraries\
I've just updated to MetaTrader 2340 and I noticed that it broke custom DLL loading in Strategy Tester. I have an EA that uses a custom DLL and it stopped working because the Strategy Tester is unable to load the DLL. Before version 2340, everything was working properly
I wrote a simple EA with a test.dll to reproduce this error. The test DLL exports only one function, which is "void __stdcall test(int & x)".
Here is the DLL code:
How to solve this issue? I attached the sample project to this post.
Thanks
What exactly re-launch of MQL5 programs and re-creation of custom indicators from MQL5 programs means?
"4.
MQL5: Significantly accelerated re-launch of MQL5 programs and re-creation of custom indicators from MQL5 programs. In some cases,
operations are performed 100 times faster"
It seems that when starting the test (i.e. by clicking "Start" in the Strategy Tester), the Tester agent is not copying the required files (including the DLL) to its internal MQL\Libraries folder. I've identified two events:
If I have a "Test.dll" file in my EAm then
1) Strategy Tester complains that the Test.dll.ex5 file is not found
2) The Test agent does not copy Test.dll to its internal folder and thus, the Strategy Tester complains that Test.dll cannot be found
%appdata%\Roaming\MetaQuotes\Tester\<MT5 ID>\Agent-127.0.0.1-3000\MQL5\Libraries\
Hi.
Many of us are running the same problem with DLL file loading on strategy tester.
There is no libraries folder any more under Tester folder. This path below is no longer existing.
%appdata%\Roaming\MetaQuotes\Tester\<MT5 ID>\Agent-127.0.0.1-3000\MQL5\Libraries\
Did you try to create Libraries forlder for Tester manually ?
Does it work ?
%appdata%\Roaming\MetaQuotes\Tester\<MT5 ID>\Agent-127.0.0.1-3000\MQL5\Libraries\

- www.mql5.com
Yes, copying the DLL manually to the Agent\MQL\Libraries folder (and creating this folder if it does not exist) seems to work as a workaround
In previous version of MetaTrarader 5, the platform did it automatically.
Hence, they just forgot to copy and paste some piece of code for this new version.
I guess this is really minor bug though in terms of coding.
Hope they can fix it and release the new version really soon.
Not many people enjoying to create, copy and paste files from folder to folder manually.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The MetaTrader 5 platform update will be released on Friday, February the 21st, 2020. The new version features the following changes:
In the previous platform update, we introduced support for operations with SQLite databases directly from MQL5. The main functions have become available through the MetaEditor user interface:
How it works
The quick database creation functionality is available from the MQL5 Wizard. You can easily create your first table and define its fields.
Upon the database creation, you will be forwarded to a new Navigator section, which features commands for managing the data.
Database tables are shown in the left-hand side window. Double-click on the table name to quickly query the first 1,000 records. In this navigator section, you can also create and open other databases, as well as work with tables.
The database can be managed in the main editor window, in which you can fill in the table, search and select data, enter SQL queries and execute other operations:

For further details about MetaTrader 5 operations with databases, please read the article entitled "SQLite: Native handling of SQL databases in MQL5".Click "Compile" in the editor to run the script:
To work with Python, do not forget to specify its path under the Settings \ Compilers section in MetaEditor. To enable the use of the MetaTrader 5 library, install it using the following command:
New naming
The existing commands have been renamed as follows:
MT5Shutdown -> shutdown
MT5TerminalInfo -> terminal_info
MT5Version -> version
MT5CopyRatesFrom -> copy_rates_from
MT5CopyRatesFromPos -> copy_rates_from_pos
MT5CopyRatesRange -> copy_rates_range
MT5CopyTicksFrom -> copy_ticks_from
MT5CopyTicksRange -> copy_tick_range
New commands
The list of supported commands has been expanded. Added trading functions, as well as functions for working with the trading history and for receiving financial symbol and current account data.
Running Python scripts on charts
Python scripts can be run directly on platform charts, similarly to regular MQL5 programs. These scripts are marked with special icons in the Navigator.
Script messages will be displayed under the "Toolbox \ Experts" section. If a MetaTrader 5 library is used in the script, it can receive trading symbol and account data, as well as perform trading operations.
Python scripts can be executed on the same chart in parallel with other MQL5 scripts and Expert Advisors. To stop a script with a looped execution, remove it from the chart.
Additional protection
To enable additional account protection when using third-party Python libraries, you may activate the "Disable automated trading via external Python API" option in terminal settings.
Python scripts can only perform trading operations when this option is disabled.
DatabaseImport
Imports data from a file to a table.
DatabaseExport
Exports a table or an SQL query result to a CSV file. The file is created in UTF-8 encoding.
DatabasePrint
Prints the table or SQL query result to the Experts journal.
The new function enables the efficient user interaction with the MQL5 program.
Common settings
In this section, you can set the maximum number of open orders and positions, which can simultaneously exist on the account. Additionally, you can configure sessions during which the program is not allowed to trade.
Margin
The section allows configuration of margin reserving rules and position accounting systems to be used in testing:
Commission
This section provides control over commissions charged for all trading operations.
The new MetaTrader 5 version will be available through the LiveUpdate system.