If to uncomment if(Count>2) ExpertRemove(), and exit by this function, thenafter EA unloading, comment "Deinit() triggered during unloading" remains displayed on the chart.
Does anyone know why, if such EA is removed from the chart via context menu, then Comment() from OnDeinitdoes not remain on the chart?
int Err; //Номер ошибкиint FunErr(int Err) // Функция обработки ошибок
gives a warning:
declaration of 'Err' hides global declaration at line 51
Another code variant
int Err; //Номер ошибкиint FunErr(Err) // Функция обработки ошибок
gives an error:
'Err' - declaration without type
How to write it correctly?
This is an error of language design in general, defended at the highest level. Two facts:
1. The MQL4++ language allows hiding variable names in nested scopes.
2. When hiding variable names in nested scopes, there must be a warning, which cannot be disabled.
To answer the question, there are at least two possibilities:
1. use name hiding, but put up with the presence of a warning (bad, you might miss a really important other warning among the many warnings about hiding names which could help detect and eliminate a potential error).
2. Do not use name hiding, even though the language has such a feature. For example, name the global variable gErr instead of Err.
Instead of prohibiting hiding names, a non-removable warning is introduced. Take advantage of it.
Zver4991: Where can I find descriptions of functions in the inclusion files?
If the files are from the standard library, of course you can. You need to open this include file, and in it you will see something like the following:
#include <Object.mqh>
//+------------------------------------------------------------------+//| Class CChart. |//| Purpose: Class of the "Chart" object. |//| Derives from class CObject. |//+------------------------------------------------------------------+class CChart : public CObject
Next, highlight "CChart" and copy it. Press F1 - help opens and in the tab "Search" paste the desired text + Enter.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I can't figure out why it hangs
while(i>=1) // Cycle through uncounted bars
i>=1always.
int i// Bar index
while(i>=1) // Loop over uncounted bars
i>=1always.
Right, I forgot about...thanks.
i--;
If to uncomment if(Count>2) ExpertRemove(), and exit by this function, thenafter EA unloading, comment "Deinit() triggered during unloading" remains displayed on the chart.
Does anyone know why, if such EA is removed from the chart via context menu, then Comment() from OnDeinit does not remain on the chart?
Shurkin:
This is an error of language design in general, defended at the highest level. Two facts:
1. The MQL4++ language allows hiding variable names in nested scopes.
2. When hiding variable names in nested scopes, there must be a warning, which cannot be disabled.
To answer the question, there are at least two possibilities:
1. use name hiding, but put up with the presence of a warning (bad, you might miss a really important other warning among the many warnings about hiding names which could help detect and eliminate a potential error).
2. Do not use name hiding, even though the language has such a feature. For example, name the global variable gErr instead of Err.
Instead of prohibiting hiding names, a non-removable warning is introduced. Take advantage of it.
In Russian: the correct option is the first, ignore the warnings.
In Russian: the correct option is the first, ignore the warnings.
Where can I find descriptions of functions in the inclusion files?
If the files are from the standard library, of course you can. You need to open this include file, and in it you will see something like the following:
Next, highlight "CChart" and copy it. Press F1 - help opens and in the tab "Search" paste the desired text + Enter.