Who can tell you what the enum of deinitialization reasons is called?
In other words, to which enum do they refer:
Constant | The value | Description |
REASON_PROGRAM | 0 |
Expert stopped working by calling the function ExpertRemove() |
REASON_REMOVE | 1 |
The program removed from the chart |
REASON_RECOMPILE | 2 |
The program recompiled |
REASON_CHARTCHANGE | 3 |
Symbol or the schedule period has been changed |
REASON_CHARTCLOSE | 4 |
Chart unopened |
REASON_PARAMETERS | 5 |
Input data the parameters were changed by the user |
REASON_ACCOUNT | 6 |
Activated another account or there was a reconnection to the trading server due to a change in the account settings |
REASON_TEMPLATE | 7 |
A different chart template has been applied |
REASON_INITFAILED | 8 |
The OnInit() handler returned non-zero value |
REASON_CLOSE | 9 |
Terminal was closed |
vvebus
Cool! Thank you all. I learned something new!
artmedia70
All. I understood the meaning of what it was about. Thank you.
igorm
checked, will help:
void OnStart()
{
enum ENUM_MY{help,help_me,go_away};
Print(typename(PERIOD_H1));
Print(typename(help_me));
}
2019.08.03 15:48:46.362 tst (EURUSD,H1) ENUM_TIMEFRAMES
2019.08.03 15:48:46.362 tst (EURUSD,H1) ENUM_MY
Artem confused, in General, the meaning of the explanations was that the reasons for deinitialization are not an enumeration, but they are constants, and
constants specified via the macro substitution #define, so the example Print(typename(REASON_CLOSE)); and returns the type int
PS: then the help is a little misleading – my previous post
artmedia70
Any enum-int. What’s the point?
igorm
OK, thank you
there was a suspicion that there was enough red in the ME for #define –
it turns out that you need to check through #ifdef
PS: I recently asked myself a question, in MT4 TRUE works, and in MT5 there will be an error you need to write true, although ME that there that there will highlight TRUE in red, so
I could not understand how these constants are obtained in MQL
fxsaber
simakovva
But to which #ifdef responds perfectly
igorm
and how did You determine this? (which is a #define )
simakovva
This is not an enum, but a #define
fxsaber
Quickly find the right enum
Print(typename(REASON_CLOSE)); // int
igorm
judging by the function signature void OnDeinit(const int reason) – these are constants, not an enumeration, in the help, as you noticed, also not
links or specify the name of the enumeration
if you want to see the reason for deinitialization in text form
, I would try to do this:
enum ENUM_REASON{REASON__PROGRAM,REASON__REMOVE,REASON__RECOMPILE,REASON__CHARTCHANGE,REASON__CHARTCLOSE,REASON__PARAMETERS,REASON__ACCOUNT,REASON__TEMPLATE,REASON__INITFAILED,REASON__CLOSE};
void OnDeinit(const int reason)
{
Print(EnumToString((ENUM_REASON)reason));
}
that is, I created a custom enumeration with a list of values similar in name (added an additional sign _ )