You don't, an EA runs and runs and runs . . . there are workarounds to take the EA off the chart from code, use the search, but I don't consider it to be "exit properly" as I don't consider that there can be such a thing.
Thanks RaptorUK.
Pierre8r
Thanks RaptorUK.
Pierre8r
Maybe I misunderstood your question though . . .
No, you don't.
It's a useful answer.
It's a sincere thanks.
I need a "exit properly", not a workarounds.
If there are no "exit properly", I will live without it.
Pierre8r
No, you don't.
It's a useful answer.
It's a sincere thanks.
I need a "exit properly", not a workarounds.
If there are no "exit properly", I will live without it.
Pierre8r
"I will live without it" does that mean in this case you leave the EA run and do nothing because workarounds is not what you need if there is no other solution ??
or do you have to do what i was suggesting.... You simply have to make it the EA is not allowing to open again the type of trades that are closed just before
So Maybe I misunderstood your question though . . . and didn't you like it that i answer the question my way...
How to exit properly from a EA?
extern bool EA.Exit = false; : #define MT4_WMCMD_REMOVE_EXPERT 33050 #include <WinUser32.mqh> int start(){ if (EA.Exit){ CloseAllOrders(); // this will remove expert from chart if (!IsStopped()) // https://forum.mql4.com/32837 WH can deadlock PostMessageA( WindowHandle( Symbol(), Period()), WM_COMMAND, MT4_WMCMD_REMOVE_EXPERT, 0); } : }How do I close an Expert programmatically? - MQL4 forum

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
How to exit properly from a EA?
Regards,
Pierre8r