Okay and what does your OnDeinit look like?
Het Tobias,
It's like a normal Expert adviser generated with Wizard:
void OnDeinit(const int reason) { ExtExpert.Deinit(); }
which proceeds as follow in Expert.mqh:
//+------------------------------------------------------------------+ //| Deinitialization expert | //+------------------------------------------------------------------+ void CExpert::Deinit(void) { //--- delete trade class DeinitTrade(); //--- delete signal class DeinitSignal(); //--- delete trailing class DeinitTrailing(); //--- delete money class DeinitMoney(); //--- delete indicators collection DeinitIndicators(); }
and DeinitSignal() looks like:
//+------------------------------------------------------------------+ //| Deinitialization signal object | //+------------------------------------------------------------------+ void CExpert::DeinitSignal(void) { if(m_signal!=NULL) { delete m_signal; m_signal=NULL; } }
My guess is that this is caused by the object being freed from memory with DeinitSignal(), so the graphics will no longer be referenced. Correct me if I am wrong please 🙏
EDIT: I commented out the Deinit functions for Signal, Inidactor, and Except but the issue still persist!
Het Tobias,
It's like a normal Expert adviser generated with Wizard:
which proceeds as follow in Expert.mqh:
and DeinitSignal() looks like:
My guess is that this is caused by the object being freed from memory with DeinitSignal(), so the graphics will no longer be referenced. Correct me if I am wrong please 🙏
EDIT: I commented out the Deinit functions for Signal, Inidactor, and Except but the issue still persist!
Your DrawLineOnChar() seems quite elaborate - I use ObjectCreate() and in your case the command would look something like this :
ObjectCreate(ChartID(), "line " + TimeToString(time), OBJ_VLINE, 0, time)) //Please read the documentation and adjust as needed
Consequently from OnDeinit() I call ObjectsDeleteAll() with a specific prefix (which I define when creating the objects), to delete the set of objects I no longer need - the others remain after the EA exits.
Give that a try
Your DrawLineOnChar() seems quite elaborate - I use ObjectCreate() and in your case the command would look something like this :
Consequently from OnDeinit() I call ObjectsDeleteAll() with a specific prefix (which I define when creating the objects), to delete the set of objects I no longer need - the others remain after the EA exits.
Give that a try
Hey,
Thank you so much It is working! 🙏🍻 but somehow ObjectDeleteAll() is not identified by the compiler! (even though it is in the documentation). I switched that with ObjectDelete().
Cheers,
Zarik
I need to see an eye doctor! 🤷♂️🤦♂️ Thank you! 🙏
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
He everybody,
I have a small function to draws vertical line on Chart:
The Signal class (let's take SignalAC.mqh in the Expert\Signal folder as an example) uses this function to visualize strategies during development.
As soon the test is over (OnDeinit() invoked), all lines will be removed from the chart, so I must have a break point in my OnDeinit() in order to keep the lines and check the results before they are erased.
Can this behavior be prevented and the objects stay on the backtest chart result after the test is complete?
Thank you in advance for your help 🙏
Cheers,
Zarik