Download MetaTrader 5

Cause EA to not trade if terminal is reopened? - page 2

To add comments, please log in or register
Keith Watford
Moderator
10568
Keith Watford  

I tested it and you're correct, it doesn't work.

Maybe you could put a message box in OnInit to confirm that you want to use the existing settings. This would, of course, pop up any time that you change timeframes as well.

bunnycat
75
bunnycat  

That sounds like a good idea.  How would you do it, I am only familiar with comments and alerts.  What did you have in mind?  One of those?  

 

Thanks for all the help!!  I wonder why that thing doesn't work.  Would the DEVS be interested in a heads up so they can fix it?  I don't know how it would actually work, cause it seems like terminating the program just happens and stops the REASON_CLOSE reason from ever being useful. 

Keith Watford
Moderator
10568
Keith Watford  
I have notified the Service desk about this as I feel that it should work. As you say REASON_CLOSE seems useless.
Keith Watford
Moderator
10568
Keith Watford  

Look up MessageBox in the reference

I haven't used it for a while, I believe that you need

#include <stdlib.mqh>

for it to work

bunnycat
75
bunnycat  

Awesome, thanks so much!!!

=) =) =) 

Keith Watford
Moderator
10568
Keith Watford  

I got a reply from the service desk.

It seems that ExpertRemove() does not permanently remove the EA from the chart. It only removes it for the session. When the terminal is closed down and restarted, the EA will be loaded again.

bunnycat
75
bunnycat  

Ah hah, thanks!  I've implemented your message box idea.  Perfect.  Maybe I'll streamline it a bit by causing it to only show for specific DeInIt reasons.  

 

Thanks again!!! =) 

whroeder1
15592
whroeder1  
Create a Global Variables of the Terminal - MQL4 Reference in deinit on terminal close and check for it in init.
bunnycat
75
bunnycat  

Thanks!!!

bunnycat
75
bunnycat  

So I did that, and instead of using it to pop the message box, I just run ExpertRemove(); in OnInit if the global variable returns true.


Works great, thanks guys!!  I get by with a little help from my friends...  

12
To add comments, please log in or register