Hi,
is there a way to pass the reason for deinitializiation to the new initialization process?
The only way I can think of is using global terminal variables.
Sven
Hi svengralla, there are several ways. Another way could be an IO file or a Log file, for instance.
Hi svengralla, there are several ways. Another way could be an IO file or a Log file, for instance.
Ok, thank you.
Hi,
is there a way to pass the reason for deinitializiation to the new initialization process?
The only way I can think of is using global terminal variables.
Sven
You don´t need to pass it because the terminal has stored it at deinit.
In the OnInit() function you just analyze the reason.
switch(UninitializeReason()) { case REASON_CHARTCLOSE: break; case REASON_REMOVE: break; case REASON_RECOMPILE: break; case REASON_CHARTCHANGE: break; case REASON_PARAMETERS: break; case REASON_ACCOUNT: break; }
You don´t need to pass it because the terminal has stored it at deinit.
In the OnInit() function you just analyze the reason.
switch(UninitializeReason())
{
case REASON_CHARTCLOSE: break;
case REASON_REMOVE: break;
case REASON_RECOMPILE: break;
case REASON_CHARTCHANGE: break;
case REASON_PARAMETERS: break;
case REASON_ACCOUNT: break;
}
About your solution, this doesn't work in all cases. For example if the chart is closed, so your EA is completely removed from memory, and you don't receive this value with UninitializeReason().
Yes, I see.
In my case the chart is not closed, but if we have to take that possibility into account, it is necessary to save the value in a file.
Thanks for clarifying it.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
is there a way to pass the reason for deinitializiation to the new initialization process?
The only way I can think of is using global terminal variables.
Sven