I tried to use ExpertRemove();
But MT4 has crushed each time I used the EA using the ExpertRemove() function.
try this;
if(condition) { int ticket = -1; ticket = OrderSend(...); if(ticket>-1) ExpertRemove(); }
try this;
I tried, but it is still crushing my MT4 platform..
Thanks anyway for your help (and Happy New Year).
I don't see how I can fix this problem at all..
:-(
Luciole
I tried, but it is still crushing my MT4 platform..
Thanks anyway for your help (and Happy New Year).
I don't see how I can fix this problem at all..
:-(
Luciole
Try run only ExpertRemove
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- Print("ExpertRemove"); ExpertRemove(); } //+------------------------------------------------------------------+
Try run only ExpertRemove
I should have thought of that, and surprisingly (or not) it does work...
I am going to try to fix it again. Thanks for your support
Ok it does work now.
My mistake was to consider that as soon as ExpertRemove is called the EA will be removed.
My program was stuck inside a loop and the EA could not called the DeOnInit function.
So, in my case, the solution was to get out of the loop just after calling ExpertRemove.
Thanks to you for your help!! :) :) :)
Luciole
I would only use ExpertRemove() as part of my security check.... ie. if(Demo == false) ExpertRemove();
Hello friend,
maybe like this...
if(IsDemo()) DemoAccount="DEMO ACCOUNT"; else ExpertRemove(); Comment("\n Server Time : ",(string)Day()," ",(string)Month()," ",(string)Year()," ",TimeToString(TimeCurrent(),TIME_MINUTES), "\n","-----------------------------------", "\n ",AccountName(), "\n ",(string)DemoAccount," ",(string)AccountNumber(), "\n ",TerminalCompany(), "\n","-----------------------------------", "\n Balance : ",DoubleToString(AccountBalance(),2), "\n Equity : ",DoubleToString(AccountEquity(),2), "\n","-----------------------------------", "\n Total Memory MB : ",DoubleToString(TERMINAL_MEMORY_AVAILABLE+TERMINAL_MEMORY_USED,0), "\n Used Memory MB : ",DoubleToString(TERMINAL_MEMORY_USED,0), "\n Available Memory : ",DoubleToString(TERMINAL_MEMORY_AVAILABLE,0), "\n","-----------------------------------", "\n Total Orders : ",DoubleToString(OrdersTotal(),0)); return(INIT_SUCCEEDED);
Hi Luciole
I'm interested why you would want to "Remove" your EA.... Why don't you just simply tell it to "Stop" trading...?
So the reason why I want to remove the EA is because in case my platform is closed (either by me or by windows updates.. it already happens)
then, if the EA is still on my platform, it will open another trade if the conditions are valid.
and I do not want that.
I do not know an other way to tell him to stop trading, do you?
Best,
Luciole
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone,
I would that once the EA took the trade, that the EA is removed from the graphic charts.
I tried to use ExpertRemove();
But MT4 has crushed each time I used the EA using the ExpertRemove() function.
Here is the code I am using:
Does anyone know why? or have a solution for me?
Thanks a lot for your time
Luciole