hah yeah, obviously that works!!! But if I forget I can lose money... Any simple fix?
if(reason==REASON_CLOSE) ExpertRemove();
put in OnDeinit
Yeah, should that be enough? It doesn't seem to work, have it exactly like this:
//+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason){ //---- if(reason==REASON_CLOSE){ ExpertRemove(); } Comment(""); //---- }
any ideas? Thanks in advance... seems like a great solution, but don't know why it's not working.
I don't know why it isn't working either.
Are you actually closing the terminal? It may not work if you simply shut down your computer without closing the terminal first.
Hey, you know I'm testing it right now. If I set the reason to 3, which is Chart change, the expert removes just by changing the time frame, but if I use 9 it doesn't work. I'm just clicking the X at the top right of the terminal. I think that's what we mean right?
Does this ever work? I wonder if clicking the X just closes the terminal before the OnDeInit function actually runs?
hmm, and for what it's worth, "file -->> exit" doesn't work either
Is there another simple way to do this with a global variable or something?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, when I reopen my terminal, sometimes I am getting unwanted trades based on settings from when I was using the EA in a prior terminal session.
How can I prevent EA from trading when I first open the terminal until I actually manually reattach it to the chart?
Thanks in advance!