On the UnitializeReason() documentation page: 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 . Sample: // this is