Close terminal from MQL4-script
//+------------------------------------------------------------------+ //| CloseTerminal.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { int hwnd=WindowHandle(Symbol(),Period()); int hwnd_parent=0; //---- while(!IsStopped()) { hwnd=GetParent(hwnd); if(hwnd==0) break; hwnd_parent=hwnd; } if(hwnd_parent!=0) PostMessageA(hwnd_parent,WM_CLOSE,0,0); //---- return(0); } //+------------------------------------------------------------------+
Are you saying this is what's causing my problem, or do I need this to prevent it?
Close terminal from MQL4-script
//+------------------------------------------------------------------+ //| CloseTerminal.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { int hwnd=WindowHandle(Symbol(),Period()); int hwnd_parent=0; //---- while(!IsStopped()) { hwnd=GetParent(hwnd); if(hwnd==0) break; hwnd_parent=hwnd; } if(hwnd_parent!=0) PostMessageA(hwnd_parent,WM_CLOSE,0,0); //---- return(0); } //+------------------------------------------------------------------+

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
The computer running this is also running other MT4's, and they are all fine. I've never run anything that had the ability to completely shut down MT4. Is this possible? Thanks