I've seen in russian forum here someone achieved that with DLL calls
but I don't have a link and can't find it right now
found here - https://forum.mql4.com/ru/10784
script for subsequent logins to accounts in Favorites tab of Naviagator window of MT4
you should modify the code to your needs
// Переменное подключение к указанному количеству торговых счетов // в закладке Избранное окна Навигатор #property show_inputs #include <WinUser32.mqh> extern int Amount = 3; // Количество счетов в закладке Избранное окна Навигатор extern int Pause = 10; // Пауза между переключениями торговых счетов #import "user32.dll" int GetParent( int hWnd ); int GetDlgItem( int hDlg, int nIDDlgItem ); int GetLastActivePopup( int hWnd ); #import #define VK_HOME 0x24 #define VK_DOWN 0x28 #define VK_ENTER 0x0D // Подключается к счету, расположенному в строчке номер Num в закладке Избранное окна Навигатор void Login( int Num ) { 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) // нашли главное окно { hwnd = GetDlgItem(hwnd_parent, 0xE81C); // нашли Избранное окна Навигатор hwnd = GetDlgItem(hwnd, 0x52); hwnd = GetDlgItem(hwnd, 0x8A70); PostMessageA(hwnd, WM_KEYDOWN, VK_HOME,0); // верхняя строчка закладки Избранное окна Навигатор while (Num > 1) { PostMessageA(hwnd, WM_KEYDOWN,VK_DOWN, 0); // сместились на нужную строчку Num--; } PostMessageA(hwnd, WM_KEYDOWN, VK_ENTER, 0); // логин Sleep(1000); // выждали hwnd = GetLastActivePopup(hwnd_parent); // нашли форму логина PostMessageA(hwnd, WM_KEYDOWN, VK_ENTER, 0); // залогинились } return; } void start() { int i; Pause *= 1000; for (i = 1; i <= Amount; i++) { Login(i); Sleep(Pause); } return; }
Поместите нужные вам торговые счета (можно разных ДЦ) в закладку Избранное окна Навигатор.
Запустите скрипт, указав количество торговых счетов в закладке Избранное окна Навигатор.
Примечание: работе скрипта не мешают гуляние по окнам (настройки терминала, свойства графика, архив котировок и т.д.) и присутствие нескольких запущенных терминалов.
found here - https://forum.mql4.com/ru/10784
script for subsequent logins to accounts in Favorites tab of Naviagator window of MT4
you should modify the code to your needs
Поместите нужные вам торговые счета (можно разных ДЦ) в закладку Избранное окна Навигатор.
Запустите скрипт, указав количество торговых счетов в закладке Избранное окна Навигатор.
Примечание: работе скрипта не мешают гуляние по окнам (настройки терминала, свойства графика, архив котировок и т.д.) и присутствие нескольких запущенных терминалов.
Thanks a lot. It really works. I really appreciate your help.
found here - https://forum.mql4.com/ru/10784
script for subsequent logins to accounts in Favorites tab of Naviagator window of MT4
you should modify the code to your needs
Поместите нужные вам торговые счета (можно разных ДЦ) в закладку Избранное окна Навигатор.
Запустите скрипт, указав количество торговых счетов в закладке Избранное окна Навигатор.
Примечание: работе скрипта не мешают гуляние по окнам (настройки терминала, свойства графика, архив котировок и т.д.) и присутствие нескольких запущенных терминалов.
That was very help ful. Do you know if it is possible to login to an account using Account number and password instead of picking them from favourite. Thanks.
i think it should be possible.
add one account to favorites
and instead of pressing just "enter" in login form
hwnd = GetLastActivePopup(hwnd_parent); // found login form PostMessageA(hwnd, WM_KEYDOWN, VK_ENTER, 0); // "enter" to login
you should send keystrokes of account number, then "Tab" key to move to password field, send keys for password and finally send "enter"
I compiled the code below, but I get error message:
2;89;C:\Program Files\MIG Trading Station\experts\reconnector login.mq4;42:5;'\end_of_program' - unbalanced left parenthesis
Someone can help me to fix?
thanks.
// ?????????? ??????????? ? ?????????? ?????????? ???????? ??????
// ? ???????? ????????? ???? ?????????
#property show_inputs
#include <WinUser32.mqh>
extern int Amount = 3; // ?????????? ?????? ? ???????? ????????? ???? ?????????
extern int Pause = 10; // ????? ????? ?????????????? ???????? ??????
int min1 = 62;
int counter = 0;
#import "user32.dll"
int GetParent( int hWnd );
int GetDlgItem( int hDlg, int nIDDlgItem );
int GetLastActivePopup( int hWnd );
#import
#define VK_HOME 0x24
#define VK_DOWN 0x28
#define VK_ENTER 0x0D
void start()
{
int hwnd = WindowHandle(Symbol(), Period());
int hwnd_parent = 0;
min1 = TimeMinute(TimeCurrent();
Sleep(70000);
if (TimeMinute (TimeCurrent() == min1) counter = counter + 1;
else counter = 0;
if (counter > 5) {
hwnd = GetDlgItem(hwnd_parent, 0xE81C); // ????? ????????? ???? ?????????
hwnd = GetDlgItem(hwnd, 0x52);
hwnd = GetDlgItem(hwnd, 0x8A70);
hwnd = GetLastActivePopup(hwnd_parent); // found login form
PostMessageA(hwnd, WM_KEYDOWN, VK_ENTER, 0); // "enter" to login
Sleep(1000);
}
counter = 0;
return;
}
Change:
min1 = TimeMinute(TimeCurrent();
to
min1 = TimeMinute(TimeCurrent());
and
if (TimeMinute (TimeCurrent() == min1) counter = counter + 1;
to
if (TimeMinute (TimeCurrent()) == min1) counter = counter + 1;
CB
Also, 'counter = counter + 1;' is like the longest way you can write what you want to happen here.
count += 1; //will add 1 to current value.. advantage to this is you can add any number.
count++; //increments the current value by 1.. advantage of this is that you can actually increment while using the variable to save a line of code in a loop or something.
Jon
Can I use an EA to auto-login different accounts?
if i have sereral different accounts,and i want to trade with all of them,can i first login with one account,send orders,then login with another account and send the same orders?
I want to do something similar. The problem as I see it is that as one can only attach one EA at a time to a chart is that having this EA on it rules out the ones that I want to utilize to handle the trading functions. It seems to me that a valid way around this is to have a 'dummy chart' in each account that doesn't do any trading but hosts the rotating LogIn EA. I think that this will do the trick? Am I one the right track with this method or am I just going down the garden path and will only end up lost in the woods?
Perchance does anyone happen to have this with the documentation in English?
Thanks to one and all.
I think that this will do the trick? Am I one the right track with this method or am I just going down the garden path and will only end up lost in the woods?
It won't be simple, but a much better answer is to have multiple copies of MT4, each logged in to a separate account, and broadcast messages between them.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can I use an EA to auto-login different accounts?
if i have sereral different accounts,and i want to trade with all of them,can i first login with one account,send orders,then login with another account and send the same orders?