New MetaTrader 5 platform build 2170: MQL5 scope, global Strategy Tester and built-in Virtual Hosting updates
Hi, I've installed today build 2170.
In the visualbactester it's not possible anymore to use my template with the indicators I want.
Probably it's a bug or is there another way to apply a template during visual mode ?
Thx,
Danny
This is great, thanks!
But...
Without the option of deciding which groups should appear open/closed by default and without the option to "expand/colapse all" the utility is very limited.
This is great, thanks!
But...
Without the option of deciding which groups should appear open/closed by default and without the option to "expand/colapse all" the utility is very limited.
I agree with Henrique Vilela!!
:)
This is great, thanks!
But...
Without the option of deciding which groups should appear open/closed by default and without the option to "expand/colapse all" the utility is very limited.
Buttons and options more ... Be careful not to make a gas plant!
I've noticed a misbehavior when testing the "input group", regarding static variables.
If the code contains static variables and input groups are used, the compiler throws an error when I try to set a new value to the static variable: "constant cannot be modified".
It seems that the static variable is treated as const. The following code, took from the docs, can lead to this error. If we take out the first line (input group) the code is compiled correctly.
input group "My inputs"
input int inputTest=0;
int Counter()
{
static int count = 0;
count++;
if(count%100==0) Print("Function Counter has been called ",count," times");
return count;
}
void OnStart()
{
//---
int c=345;
for(int i=0;i<1000;i++)
{
c=Counter();
}
Print("c =",c);
}
Best regards,
All these changes look really great, but I'd like to ask a question about linking to 64 bit C# .NET dll.
I have one that I am in the process of coding using Visual Studio. It was working with no errors before this latest Metatrader 5 build, and now the MQL5 code cannot find any of the functions exposed by the dll.
In the original (working) code, I simply used
#import "MyDll.dll"
The MQL5 code which implements the dll functions now won't compile any more, eg
MyDll::ExportedFunction();
I noted that in item 15 above the function is explicitly declared, similar to the approach for a 32 bit MQL4 import. It didn't need to before this build, but I tried it anyway
#import "MyDll.dll" void ExportedFunction(); #import MyDll:ExportedFunction();
This does compile without error, but I then get a runtime error in Metatrader 5 Experts log saying
Cannot find 'ExportedFunction' in MyDll.dll
Unresolved import function call
Any ideas?
All these changes look really great, but I'd like to ask a question about linking to 64 bit C# .NET dll.
I have one that I am in the process of coding using Visual Studio. It was working with no errors before this latest Metatrader 5 build, and now the MQL5 code cannot find any of the functions exposed by the dll.
In the original (working) code, I simply used
The MQL5 code which implements the dll functions now won't compile any more, eg
I noted that in item 15 above the function is explicitly declared, similar to the approach for a 32 bit MQL4 import. It didn't need to before this build, but I tried it anyway
This does compile without error, but I then get a runtime error in Metatrader 5 Experts log saying
Cannot find 'ExportedFunction' in MyDll.dll
Unresolved import function call
Any ideas?
Fixed! There is a change of behaviour, but this aligns to these release notes: https://www.metatrader5.com/en/releasenotes/terminal/1898. My working code had followed another example, which will no longer compile, which used the Dll name as the qualifier for the exported functions. The qualifier should be the C# class name.

- 2018.10.26
- MetaQuotes Software Corp.
- www.metatrader5.com
I've noticed a misbehavior when testing the "input group", regarding static variables.
If the code contains static variables and input groups are used, the compiler throws an error when I try to set a new value to the static variable: "constant cannot be modified".
It seems that the static variable is treated as const. The following code, took from the docs, can lead to this error. If we take out the first line (input group) the code is compiled correctly.
input group "My inputs"
input int inputTest=0;
int Counter()
{
static int count = 0;
count++;
if(count%100==0) Print("Function Counter has been called ",count," times");
return count;
}
void OnStart()
{
//---
int c=345;
for(int i=0;i<1000;i++)
{
c=Counter();
}
Print("c =",c);
}
Best regards,
Thank you for your message.
Fixed.
Please wait for updates.
Hi, after this build my code is not compiling anymore.
I am getting erros on the usage on enumeration, it is not recognizing an include of a custom enumeration.
Example:
//+------------------------------------------------------------------+ //| ClassA | //+------------------------------------------------------------------+ class ClassA { private: public: enum ENUM_TEST {TESTA,TESTB}; // List of structure type void ClassA(void){}; void ~ClassA(void){}; // Destructor }; //+------------------------------------------------------------------+ //| ClassB | //+------------------------------------------------------------------+ #include <ClassA.mqh> class ClassB { private: ENUM_TEST test; // Default category public: void ClassB(void) {}; void ~ClassB(void) {}; // Destructor };
Compilation ERROR:
'ENUM_TEST' - unexpected token, probably type is missing? ClassB.mqh 8 4

- 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, October 4, 2019 The new version features the following changes:
In earlier versions, Virtual Hosting functions were available in the context menu of the Navigator window. Now all the necessary information and control commands are conveniently arranged under the "VPS" tab:
Basic subscription information appears on the left side:
Using the Start/Stop button, the virtual terminal can be quickly started or stopped.
Data about hosting server hardware and CPU consumption charts are displayed in the right hand side window section. Based on the displayed information, you will be able to respond in a timely manner if your Expert Advisor or indicator utilizes excessive memory or CPU time.
Information about the last trading environment migration as well as migration commands are also available here. These commands enable fast environment migration after purchasing a subscription.
A virtual platform can be rented from the "VPS" tab. The renting process has not changed and it is still fast and easy. You only need to select a plan and a suitable payment method. The best server for connecting to your broker will be selected automatically.
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: in the accounts menu in Navigator and in Toolbox > Trade tab:
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.
Commissions
Information on commissions charged by a broker for the symbol deals. Calculation details are displayed here:
For example, the following entry means that a commission is charged immediately upon deal entry and exit. If the deal volume is between 0 to 10 lots, a commission of 1.2 USD is charged per operation. If the deal volume is between 11 to 20 lots, a commission of 1.1 USD is charged per each lot of the deal.
0 - 10 | 1.2 USD per deal
11 - 20 | 1.1 USD per lot
Example: Code contains declaration of two structures with the same name even though they belong to different classes. In earlier versions such a declaration produced a compilation error: "identifier already used". Now this code will be successfully compiled and executed. For a proper access to the desired variable/structure/function from outside of its scope, you should specify a class (in this case it is CBar::Item).
Added namespace support which provides more possibilities when using third-party code/libraries in MQL5 applications.
Upon execution the following result is displayed as output:
2019.09.18 13:39:35.949 TestScript (AUDCAD,H1) NS::func
2019.09.18 13:39:35.949 TestScript (AUDCAD,H1) C::C
2019.09.18 13:39:35.949 TestScript (AUDCAD,H1) NS::C::C
In this example, the compiler will return errors for "a1=a2" and "b1=b2":
function 'void A::operator=(const A&)' was explicitly deleted here
attempting to reference deleted function 'void B::operator=(const B&)'
function 'void B::operator=(const B&)' was implicitly deleted because it invokes deleted function 'void A::operator=(const A&)'
There are three main methods to close a position:
In the below Expert Advisor code,input parameters are grouped according to their purpose:
When such an Expert Advisor is launched in the Strategy Tester, input parameter blocks can be collapsed or expanded by a double click on the group name, as well as all parameters within a group can be selected for optimization with a single check box.
In earlier versions, the following error returned during compilation:
Now, instead of the error, the built-in MQL5 function with a higher priority will be used by default. The imported function can be called by explicitly specifying the scope:
Start page
Now, after tester launch, instead of multiple settings the user sees a list of standard tasks, by selecting which they can quickly start testing. The new design is primarily intended for unexperienced users.
We have selected the most frequent strategy testing and optimization tasks and we have added them in the start page. In addition, one of the previously performed tasks can be restarted from the start page. If you have run a lot of tasks and they do not fit into the start page, use the search bar. You can find a test by any parameter: program name, symbol, timeframe, modeling mode, etc.
Hiding irrelevant parameters
After selecting a task, the user proceeds to further testing parameters: selection of an Expert Advisor, symbol, testing period, etc. All irrelevant parameters which are not required for the selected tasks are hidden from the setup page. For example, if mathematical calculations are selected, only two parameters should be specified: selection of a program to be tested and the optimization mode. Testing period, delay and tick generation settings will be hidden.
Convenient testing setup
For convenience some of the parameters on the setup page have been rearranged. Extended explanations have been added for the delay and visualization parameters. In addition, testing settings can now be saved and uploaded manually, and thus a trader can quickly return to previous settings.
Using the same tab you can quickly open the program for editing in MetaEditor.
Profit calculation in pips
Using the settings, you can enable profit calculation in pips. This mode accelerates testing while there is no need to recalculate profit to deposit currency using conversion rates (and thus there is no need to download the appropriate price history). Swap and commission calculations are eliminated in this mode.
Please note that when calculating profit in pips, the deal volume does not matter. Only the number of won/lost pips is calculated for each deal. Also margin control is not performed in this mode. Use it only for quick and rough strategy estimation and then check the obtained results using more accurate modes.
General improvements
Testing start/stop button and progress bar have been moved to the tabs bar. Thus, the user can control the process from any Strategy Tester section. Testing start/stop commands have also been added to context menus of settings and inputs sections.
In earlier versions, executed task results were saved to files only when optimizing Expert Advisors. Now, cache files are also saved during single tests, using which users can return to previous calculations and view statistics, balance, equity and deposit loading graphs, at any time. In future releases, this option will enable comparison of testing results.
To load previous test results, use the new Tester start page: click "Previous results" and select the desired site:
The MetaEditor includes a built-in code styler, which enables automatic formatting of program text in accordance with the adopted standard. Now in addition to common style, you can use other popular standards. To do this, open MetaEditor settings and select the desired style:
The following parameters can be additionally set for the styler:
Spaces per indent
Sets the number of spaces used in aligning of nested constructions:
Replace tabs with spaces
If this option is enabled, the styler will replace all tabs in the code with spaces. The number of characters per tab is set in the General section.
Delete empty lines
When this option is enabled, the styler will delete all lines having only a line break character.
Insert spaces after commas and semicolons
When this option is enabled, the styler will visually separate constructions with element enumerations. Example:
Insert spaces around declaration operators
When this option is enabled, the styler will insert spaces around the assignment, equality, comparison, and other operators. Example:
The platform interface is now available in 50 languages, which are spoken by more than 4 billion people.
To set you language for the interface, navigate to the "View / Language" menu at the top of the terminal.
The update will be available through the Live Update system.