I want to convert MQL4 TO MQL5 Source code

 
extern int AccountRow = 1;  
extern int DelayMinutes = 2;    
 
// AccountRow   - Your favourites account number
// DelayMinutes - Delay in minutes, has to be greater than the chart timeframe

#include <WinUser32.mqh>
#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
 
#define PAUSE 1000
datetime Old_Time=0;
bool is_reconect = true;
 
void OnInit()
{
   Old_Time=iTime(NULL,0,0);
   OnTick();
}
 
void OnTick()
{
   if (!IsDllsAllowed())
   {
      Alert("Watchdog: DLLs not alllowed!");
      return;
   }
   
   while (!IsStopped())
   {
      RefreshRates();
      if (Old_Time  == iTime(NULL,0,0)) is_reconect=true;
      else is_reconect=false;
      Old_Time=iTime(NULL,0,0);
      if (is_reconect)
      {
         Print("Watchdog: The chart has not been updated in " + string(DelayMinutes) + " minutes. Initating reconnection procedure...");
         Login(AccountRow);
      }
      Sleep(DelayMinutes*60*1000);
   }
   return;
}

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(PAUSE);                                 
      
      hwnd = GetLastActivePopup(hwnd_parent);  
      PostMessageA(hwnd, WM_KEYDOWN, VK_ENTER, 0); 
   }
 
   return;
}
 
Migrating from MQL4 to MQL5
Migrating from MQL4 to MQL5
  • www.mql5.com
This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.
 
Sir,I want to Convert MQL4 TO MQL5 Source code 
Easy. Just delete that code and you are done. Terminals automatically reconnect.
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Carl Schreiber #:

Before you try to learn MQL5 learn to search!

https://www.mql5.com/en/articles/81
https://www.mql5.com/en/articles/66

https://www.mql5.com/en/articles/7258
Library MT4-Orders for MetaTrader 5  https://www.mql5.com/en/code/16006&nbsp;    

Sir, I tried itself but I converted mql4 to mql5 source code and then It is working EA.

Thank you Sir...

 
William Roeder #:
Easy. Just delete that code and you are done. Terminals automatically reconnect.

Sir, I deleted that code and then I updated this post.

Thank you Sir