
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi there
when testing an EA and stopping it in middle of test, the deinit function is not called. i checked this multiple times and read the documents.
i have an object that writes csv journal files and in the end (when EA is closed or stopped) i need to add a summery and i decided to do it in object destructor which is called in deinit.
this is the destructor code:
//--------------------------------------------------------------------+
// Destructor:
//--------------------------------------------------------------------+
void
JournalWatch::~JournalWatch( )
{
double total = NormalizeDouble(this.total_profit + this.total_swap + this.total_comission,2);
FileSeek(this.file_handle, 0, SEEK_END);
FileWrite(this.file_handle, "","","","","",this.total_profit, "","","","","",
this.total_swap,this.total_comission, "total: "+( string )total);
}
and this is how i create and delete the object:
//--- import journal class
#include <journal_Base.mqh>
JournalWatch *journal = new JournalWatch();
...
...
...
void OnDeinit(const int reason)
{
EventKillTimer();
delete journal;
Print("journal deleted");
}
i have looked around in forum and yet couldn't find any answers. if anyone have any suggestions or workarounds about how i can call the deinit or accomplish writting summery i appreciate it a lot.