How to logout in MT4

 

Most of the comments suggest closing down MT4, or change accounts. But if you need to keep the strategy tester running and just want to logout from the broker. it's very simple.

I needed to use a VPN, and wasn't sure how the connection with the broker would behave with a sudden ip change, while running tests. Closing MT4 would of lost days of results, with no quick google solution.

Goto File -> Login to trade account. untick checkbox, "Save account information". Delete Login and password, then press Login Button. This will disconnect you from the server and keep MT4 running.

Hope it helps others in similar situation.

 
FiveRows:

Most of the comments suggest closing down MT4, or change accounts. But if you need to keep the strategy tester running and just want to logout from the broker. it's very simple.

I needed to use a VPN, and wasn't sure how the connection with the broker would behave with a sudden ip change, while running tests. Closing MT4 would of lost days of results, with no quick google solution.

Goto File -> Login to trade account. untick checkbox, "Save account information". Delete Login and password, then press Login Button. This will disconnect you from the server and keep MT4 running.

Hope it helps others in similar situation.

That's nice to know.

 
Or - much easier , just go to account list, click LOGIN and put WRONG password like : hasfalkjsdlkaj and click OK, this will save wrong password and disconnect you from broker
 
Bartlomiej Gorski:
Or - much easier , just go to account list, click LOGIN and put WRONG password like : hasfalkjsdlkaj and click OK, this will save wrong password and disconnect you from broker

That's experience talking.

 
Bartlomiej Gorski:
Or - much easier , just go to account list, click LOGIN and put WRONG password like : hasfalkjsdlkaj and click OK, this will save wrong password and disconnect you from broker

Yes, but messy coding...:)

If you clear the boxes and untick, next time you login, your details are back.

 
FiveRows:

Yes, but messy coding...:)

If you clear the boxes and untick, next time you login, your details are back.


Wierd. That never happend to me. I do the trick with wrong password from 10 years...
 
Hi I would like to start a real Acc 

 
FiveRows:

Most of the comments suggest closing down MT4, or change accounts. But if you need to keep the strategy tester running and just want to logout from the broker. it's very simple.

I needed to use a VPN, and wasn't sure how the connection with the broker would behave with a sudden ip change, while running tests. Closing MT4 would of lost days of results, with no quick google solution.

Goto File -> Login to trade account. untick checkbox, "Save account information". Delete Login and password, then press Login Button. This will disconnect you from the server and keep MT4 running.

Hope it helps others in similar situation.

https://www.mql5.com/en/forum/125008

#import "user32.dll"
   int PostMessageA(int hWnd, int msg, int wparam, int lparam);
   int GetParent(int hWnd);
#import
   
#define WM_CLOSE 16


int start()
{
   PostMessageA(GetParent(GetParent(GetParent(WindowHandle(Symbol(), Period())))), WM_CLOSE, 0, 0);
}   
ShellExecute function (Windows)
  • msdn.microsoft.com
Performs an operation on a specified file. Syntax Parameters hwnd [in, optional] A handle to the parent window used for displaying a UI or error messages. This value can be NULL if the operation is not associated with a window. lpOperation [in, optional] A pointer to a null-terminated string, referred to in this case as a verb, that specifies...
 
FiveRows:


Goto File -> Login to trade account. untick checkbox, "Save account information". Delete Login and password, then press Login Button. This will disconnect you from the server and keep MT4 running.


whitestack.com

closing metatrader with EA
closing metatrader with EA
  • 2010.04.04
  • www.mql5.com
Hi I want to make an EA that closes all orders and exits metatrader if certain criteria have been reached...
Reason: