Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 185
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Good afternoon.
I need the EA to quit after a certain event.
I understand this is the deinit() function , I need to call it somehow. This is a quote from the tutorial:
"The special function deinit() is also called for execution by the client terminal when the client terminal is shut down, when the financial instrument window is closed, just before changing a financial instrument and/or chart period, when the program is successfully recompiled in the MetaEditor, when the input parameters are changed, and when the account is changed. "
So I have to close the terminal manually, for example, for this function to be called?
I tried to call this function when a condition triggered, it was executed, but a new tick came and the start function was started again.
How do I still terminate the program?
Thank you.
To close the terminal programmatically, insert at the very beginning of the code before the start() function:
In the start() function, when you need to close the terminal, call ExitMT4(), which you declare outside the start() function
To close the terminal programmatically, insert at the very beginning of the code before the start() function:
In the start() function, when you need to close the terminal, call ExitMT4(), which you declare outside the start() function
Thank you very much for detailed reply.
Basically, it would be enough for me just to terminate the EA, I don't need to close the terminal. Isn't there an easy way to do it?
I think deinit() should somehow solve this issue, but I must be doing something wrong...
I can't remove Terminal.exe from Alpari Limited, build 509.
When using the control panel to uninstall, a "You do not have sufficient rights to uninstall. Contact your system administrator!".
When using Uninstall.exe it displays "Server has returned the link".
Alpari technical support is unable to say anything comprehensible. They just suggested that I should delete the entire folder and install the terminal in another directory.
I have Win 7, Ultimate. Administrator rights activated, I ran Uninstall.exe as Administrator.
I would be very grateful for any help in solving this problem.
Thank you very much for the detailed reply.
In principle it would be sufficient for me to simply terminate the EA, there is no need to close the terminal. Isn't there an easy way?
I think deinit() should somehow solve this issue, but I must be doing something wrong...
Not deinit() but return(0);
If I am not mistaken, return(0) will simply end the current function start() and wait for the next tick, while I need the EA to end its work, as if I had manually detached it from the chart.
I checked it in practice and it keeps displaying "0 open orders" alert with every tick.
I didn't wait for the cherished "Bye".
Can't uninstall Terminal.exe from Alpari Limited, build 509.
When using the control panel to uninstall, a "You do not have sufficient rights to uninstall. Contact your system administrator!".
When using Uninstall.exe it displays "Server has returned the link".
Alpari technical support is unable to say anything comprehensible. They just suggested that I should delete the entire folder and install the terminal in another directory.
I have Win 7, Ultimate. Administrator rights activated, uninstall.exe run as administrator.
Will be very grateful for any advice to solve this problem
Some malicious programs (mail.ru, I had it) redistribute access rights, so you with administrator privileges have no access to their removal.
The problem was solved by the method of scientific poke in the redistribution of rights (click on the folder, properties, security, change, add, optional, types of objects, search.......)
But then I got acquainted with "Revo uninstaller" and all the hassle of deleting something disappeared + the certainty that the registry was cleaned of their activities.
If I am not mistaken, return(0) will simply finish the current function start() and wait for the next tick. I need the EA to finish its work as if I had manually detached it from the chart.
I checked in practice - endlessly with every tick it gives the alert "Open orders - 0".
I have not waited for the cherished "Bye".
Some malicious programs (mail.ru I had) redistribute access rights and make it so that you with administrator rights do not have access to their deletion.
The problem was solved by the scientific method of redistributing permissions ( PCM on the folder, properties, security, change, add, optional, types of objects, search.......)
But then I got acquainted with "Revo uninstaller" and all the hassle of deleting something disappeared, + the certainty that the registry was cleaned FROM their activities.
Your wish is reminiscent of the "draughtsman" joke. If you want advisor to stop trading, then by activation of (global) flag (after some conditions), interrupting function start() (exit via return) will give the expected result.
This is roughly what it looks like:
This is roughly what it looks like: