debug issues

 
Good day. 
I have been trying to Rn Debug in mt5 and when I press F5 or the debug button from Meta-editor I am taken to MT5 but immediately I am taken back to Meta-editor and no debug is initiated. 

Is this a common issue
 
Set break points first.
 
William Roeder:
Set break points first.

I have soon after Initialisation it goes to De-init and reason is 4  chart Chart closed.

 

If a runtime error occurs, debugging stops at that point.

In this case, you should step through the breakpoints and debug them to determine where the error occurred.

 
int OnInit()
  {
//--- create timer
   EventSetTimer(60);
   printf("Initialisation");
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   int i = 0;
   int j = i+1;
   static int testing;
   testing+= j-1;
   if(testing>j)
    Print("testing");
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   
  }

even if I enter this code and try and test it in debug with my break points in every line in the OnTick() even if I set Break point on the if Statement even if on the statement before the if statement noting is happening

I am using Metaeditor/mt5 version 5 built 2485

funny but on my Brokers MT5 the debugging is working flawlessly. but on the default it is de-initialising with error 4 

 
Jefferson Metha :
Good day. 
I have been trying to Rn Debug in mt5 and when I press F5 or the debug button from Meta-editor I am taken to MT5 but immediately I am taken back to Meta-editor and no debug is initiated. 

Is this a common issue

Please describe in steps what exactly YOU are doing where you click. Confirm each step with a screenshot.

 
Vladimir Karputov:

Please describe in steps what exactly YOU are doing where you click. Confirm each step with a screenshot.

 Step 1 


  
Step 2 soon after I press Debug in Step 1 it goes to MT5 then back to editor 



 
in Mt5 I get this from my Expert Tab, 

caused by the following code in My EA 

int OnInit()
  {
//--- create timer
   printf("Init 1");
//---code
   printf("Init 2");
//---code
   printf("Init 3");
//--- code
  printf("Init 4");
//---code
   return(INIT_SUCCEEDED);
  }



void OnDeinit(const int reason)
  {
//--- destroy timer
   Print("reason " + (string) reason);
   EventKillTimer();
   Comment("");
  }
 

Nothing happened.

I was able to debug it normally.
 
Jefferson Metha :


  
Step 2 soon after I press Debug in Step 1 it goes to MT5 then back to editor 

What exactly did you click there? The Debug menu has many items.

Please write in detail. Confirm every step with a screenshot. I do not know how to read other people's thoughts.

 
Vladimir Karputov:

What exactly did you click there? The Debug menu has many items.

Please write in detail. Confirm every step with a screenshot. I do not know how to read other people's thoughts.

Step 1. 
I press F5 or this image    from the debug menu     

soon after I am taken to MT5 (this is Normal), but then immediately, I am taken back to metaeditor 

Step 2. 

I go to MT5 Manually to check error report inside the Expert Tab. 
I see that the EA Initialised successfully however soon after Initialisation it Runs

void OnDeinit(const int reason)
  {
//--- destroy timer
   Print("reason " + (string) reason);
   EventKillTimer();
   Comment("");
  }


 
If I follow the above Procedurein my Brokers MT5 I enter into debugging

 

(BrokerName Hidden ah per Ts n Cs of Forum) 


 

I didn’t understand anything: I can’t understand what exactly you want.

After you have selected "Debugging on real data" (   ) You go to MetaTrader 5 - a new chart will open in the terminal on which debugging will be performed. This is normal. It is right


It is not clear further - what happens next: return to the editor can be for one reason only - if you set a breakpoint inside the code in MetaEditor. Do you put a breakpoint?

Reason: