MetaTrader 5 platform beta build 2155: MQL5 scope, global Strategy Tester and built-in Virtual Hosting updates
21. MetaEditor: Added ability to configure code styler.
Is it possible to fix that behaviour please :
// Original if(condition1) { } else if(condition2) { } else if(condition3) { } else { }
Become :
// After styler applied (Metaquotes style) if(condition1) { } else if(condition2) { } else if(condition3) { } else { }
There should not have additional indentation here.
See also this example, which is even worst.
//--- int try =3; while(try >0) { try --; if(try ==2)Print("i==2"); }
I can't imagine you will say it's a feature !
Tested with ME build 2146.
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.
Yours faithfully and best wishes: László Müller (voyevoda), Dombóvár, Hungary.
grid cells horizontally. Why? The plot should fill the entire plot region
of the subwindow.
Please fix these issues as soon as possible!
Yours faithfully and best wishes: László Müller, Dombóvár, Hungary.
Yours faithfully and best wishes: László Müller, Dombóvár, Hungary.
MQL4 and MQL5 programming languages.
Many thanks for considering my request!
Dear MetaQuotes Software Corp.!
I think that your developers must implement the functions
of the MQL preoprocessor
as the C/C++ CPP functions. With the following code snippet the second macro for the
indirection is
now not necessary.
#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; }
After the recent updates the `p_evaluate_paste' macro is not necessary anymore.
But why? Now it is not possible to pass for
example the `apple' argument as a string
to a macro without the replacement of it. The solution is not complete now and not
a good solution. You have to
implement the MQL preprocessor facilities and functions
to operate similar as the facilities and functions of the C/C++ CPP, the C preprocessor.
Please consider this issue
too! You have to program the preprocessor with the above
mentioned possibility. The correct solution is the usage for example the `p_paste' and
the `p_evaluate_paste' macros,
whichever you need!
Please fix these issues as soon as possible! I have at least 400,000 lines of MQL code
in my ATS framework now and I have
to program with some advanced features like
this.
Many thanks for considering my request!
Yours sincerely: László Müller, Dombóvár, Hungary.
Dear MetaQuotes Software Corp.!
There is another small issue with templates. Consider the following code snippet and create a
compilable `.mq4' or `.mq5' file
with it. Why is the `main_1' not compilable? I think it should be.
#property strict int func_0 (int x) { return 5 + x; } int func_1(int x) { return 8 + x; } typedef int (*funcs_type)(int); template<typename value_type, typename func_0_type, typename func_1_type> value_type apply(value_type x, func_0_type func_0, func_1_type func_1) { return func_1(func_0(x)); } //This is compilable with 0 errors, 0 warnings. void main_0() { funcs_type f_0 = func_0; funcs_type f_1 = func_1; int x = 10; PrintFormat("%d\n", apply(x, f_0, f_1)); return; } //This is not compilable! Why it is necessary to //create a function type with a `typedef' and to //create 2 variables with that type? Please fix //this issue! void main_1() { int x = 10; PrintFormat("%d\n", apply(x, func_0, func_1)); return; } //This is not compilable! Just for trying something. void main_2() { int x = 10; PrintFormat("%d\n", apply(x, &func_0, &func_1)); return; }
Please fix these issues! With the template metaprogramming and the multiple inheritance
from interfaces your MQL4 and MQL5
languages (MQL) will be really useful with many many
functions
and opportunities! This is a must.
Many thanks for considering my requests!
Yours sincerely and best wishes: László Müller, Dombóvár, Hungary.
Dear MetaQuotes Software Corp.!
There is another small issue with templates. Consider the following code snippet and create a
compilable `.mq4' or `.mq5'
file with it. Why is the `main_1' not compilable? I think it should be.
Try casting the arguments...
void main_1() { PrintFormat("%d\n", apply(10, (funcs_type)func_0, (funcs_type)func_1)); }
- 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 beta version of the updated MetaTrader 5 platform will be released on September 20, 2019. We invite traders to join the testing of the new platform, to evaluate all its features and to help developers fix errors.
To update the MetaTrader 5 platform up to build 2155, 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.
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 in 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 window part. Based on the displayed information, you will be able to respond in a timely manner if your Expert Advisor or indicator uses 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 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 of the appropriate information is provided by the broker.
Exchange
The name of the exchange in which the security is traded. The exchange name 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 from 0 to 10 lots, a commission of 1.2 USD is charged per operation. If the deal volume is 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, which though belong to different classes. In earlier versions such 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.
As a result of execution the following result is 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; the rule behavior will be different for each of the methods:
In earlier version, the following error was 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 have added them to 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, 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, allowing you to return to previous calculations and to 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 update will be available through the Live Update system.