Terminate an EA.

 

Hi,

How can I terminate an EA if certain inputs are incorrect? I do not want to put a conditional return in start() because its still running and catching the error on every tick.

I need something that can just stop executing the EA if the input params are incorrect.

Is this possible?

Thanks,

JForex.

 
JForex:

Hi,

How can I terminate an EA if certain inputs are incorrect? I do not want to put a conditional return in start() because its still running and catching the error on every tick.

I need something that can just stop executing the EA if the input params are incorrect.

Is this possible?

Thanks,

JForex.

Yep.


The EA can be unloaded by WinAPI message. Searh the forum for PostMessageA()

 
#include <WinUser32.mqh>

...


PostMessageA(WindowHandle(Symbol(), Period()), WM_COMMAND, 33050, 0);
 

That's amazing, thanks very much. I would like it to stay on the window with a sad face indicating it failed. I know its possible since I saw it in another EA. How can I do it?

Is there any documentation on these DLL functions and how to use them?

Also, I want to write to the chart window just like the standard Symbol is written on the chart in the upper right corner. How can I do it? (Not using labels and text objects.)

Thanks,

JForex.