Disabling an EA from trading

 

Hello,

I'm a total newbie in mql coding. I can't figure out how to deinitialize an EA or disable it from trading any further under some circumstances.

Here's example:

If the EA make 5 trades (my scalping method required closing all trades on same pair at once.) then it close that 5 trades in profits or loss, I want the EA to disable itself from trading totally until I reattach it again.


So what I need to write to the EA is this statement:

If under any circumstance there is one or more trades closed, then deinitialize.


What's the code for this, and where should I put this code?


Thanks

Reason: