Executing code when chart is closed

 

Hi,

is there an event handler or a something other to allow me exceuding some code when a chart is closed?


Thanks

 
antony23:

Hi,

is there an event handler or a something other to allow me exceuding some code when a chart is closed?


Thanks

Yes, use the OnDeinit function and check if the reason for deinitialization is REASON_CHARTCLOSE.

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...