MQL4 - automated forex trading   /  

Documentation

MQL4 Reference  Checkup  UninitializeReason

 
Use the opportunities of
MQL5 in MetaTrader 5
Study the new MQL5 language
Study the new MQL5 language.
Reference is already available
int UninitializeReason( )
Returns the code of the uninitialization reason for the experts, custom indicators, and scripts. The returned values can be ones of Uninitialize reason codes. This function can also be called in function init() to analyze the reasons for deinitialization of the previour launch.
Sample:
  // this is example
  int deinit()
    {
     switch(UninitializeReason())
       {
        case REASON_CHARTCLOSE:
        case REASON_REMOVE:      CleanUp(); break; // cleaning up and deallocation of all resources.
        case REASON_RECOMPILE:
        case REASON_CHARTCHANGE:
        case REASON_PARAMETERS:
        case REASON_ACCOUNT:     StoreData(); break;  // prepare to restart
       }
     //...
    }