Debugger don't stop

 

Hi, MQL5-experts:

My MetaEditor don't stop at the defined breakpoints. I am starting debugging with F5. The first lines of codes are


int OnInit()
  {
//--- Do we have sufficient bars to work
   if(Bars(_Symbol,_Period)<60) // total number of bars is less than 60?                    // <----- HERE  ***********
     {
      Alert("We have less than 60 bars on the chart, an Expert Advisor terminated!!!");// <---- AND HERE *********
      return(-1);

     ...


I have set breakpoints at the marked lines by doubelklicking the line befor started debugger. The problem is, debugger never stops anywhere and output eacht time the Alert-Error-Message when started.

1) How to enable the debugger to stop?

2) I have defined the TIME_FRAME and Symbol here: Menu->Debug->Options->Debugging..... BUT, where can i define the date-From and date-TO Time-Period (example: 1.7 - 30.7) ???


Thanks for any help!

Documentation on MQL5: Timeseries and Indicators Access / Bars
  • www.mql5.com
Timeseries and Indicators Access / Bars - Documentation on MQL5
 
Do i need instal .NET studio or someting like this to enbale Debug-Funktion. I have MT5 downloaded from activetraders. My op-System is win xp. Should i have a OnStart() Function? What preconditions are necessary for debugging?
 

What's a problem? It works properly. You should't place breaks at the comments, it is useless.

Show your screenshot.


 
Rosh:

What's a problem? It works properly. You should't place breaks at the comments, it is useless.

Show your screenshot.


Thanks for Help! It don't works. So i tryed with another downloaded EA (my_frist_ea.mq5). The system allways trys to start compiling with the previous EA (screenshot). But i deleted it. Now I get a popup, asking me if i want really change the EA. But when commit it, it works and i can debug the my_frist_ea.mq5. In a seconed step i copied all functions step by step from my EA to the file "my_frist_ea.mq5". Now i can debug my EA. But the system is still asking each time, if i really want change EA. I don't know where i can costumize it. I do not understand 100% how it works.

Files:
 

Today a new problem with the debugger: It stops in the method "int OnInit()" but don't enter the method "void OnTick()".

I have attached two screenshots: 1) last seen debugger and 2) debugger lost. It seems like debugger is working like in a infinite loop. But i don't see it anywhere. What can i do to have a stable reliable development-environment? With this situation here i can't develop anything.

Thanks for help!

 

Please help!!! I deinstalled all components of meta trader 5, downloaded new, reinstalled all... few times. But still the same problem (see attached picture): The debugger appears in the onInit- Method but after the last instruction "return (0);" the debug-arrow disappears also with the debugger-mode. The Button F5="stard debugging" are greyed out. Also Button "compile". But buttons "stop" and "pause" are awalable. But nothing happends and i can't go on with debugging.


Why my method OnTick() is not called?

Where is the debugger- cursor/arrow?

How to awoid these problems?


Pleas help!!

Thanks!

MQL5.community - User Memo
MQL5.community - User Memo
  • 2010.02.25
  • MetaQuotes Software Corp.
  • www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
 
joi:

Please help!!! I deinstalled all components of meta trader 5, downloaded new, reinstalled all... few times. But still the same problem (see attached picture): The debugger appears in the onInit- Method but after the last instruction "return (0);" the debug-arrow disappears also with the debugger-mode. The Button F5="stard debugging" are greyed out. Also Button "compile". But buttons "stop" and "pause" are awalable. But nothing happends and i can't go on with debugging.


Why my method OnTick() is not called?

Where is the debugger- cursor/arrow?

How to awoid these problems?


Pleas help!!

Thanks!

You have to wait enough till a tick was generated, then the OnTick funciton will be called. And as I see from your last Attachment, you rdebugger is still in the OnInit Function.
 
You seem to be having too many problems with the editor and debugger whereas mine works fine. I used to have a few irreparable problems with the terminal and, you know what i do now for developing in MT5? I run a dedicated virtual machine with the free Microsoft Virtual PC 2007 with Windows XP on it and now i'm always coding under a safe and easy to backup/restore enviroment. Try it for yourself installing everything from scratch (Windows and MT5, nothing else needed) if you are still running into problems with the devel platform.
 
use print instead.
Documentation on MQL5: Common Functions / Print
Documentation on MQL5: Common Functions / Print
  • www.mql5.com
Common Functions / Print - Documentation on MQL5
 
joi:

Today a new problem with the debugger: It stops in the method "int OnInit()" but don't enter the method "void OnTick()".

I have attached two screenshots: 1) last seen debugger and 2) debugger lost. It seems like debugger is working like in a infinite loop. But i don't see it anywhere. What can i do to have a stable reliable development-environment? With this situation here i can't develop anything.

Does it mean that you have to functions OnInit() with duffrerent result type? If it does, you have to remove one of them.
 
joi:

Thanks for Help! It don't works. So i tryed with another downloaded EA (my_frist_ea.mq5). The system allways trys to start compiling with the previous EA (screenshot). But i deleted it. Now I get a popup, asking me if i want really change the EA. But when commit it, it works and i can debug the my_frist_ea.mq5. In a seconed step i copied all functions step by step from my EA to the file "my_frist_ea.mq5".

On your picture I see the Strategy Tester panel. Do you try to debug your EA during back testing? It is impossible at the moment.

Now i can debug my EA. But the system is still asking each time, if i really want change EA. I don't know where i can costumize it. I do not understand 100% how it works.

May be have launched another copy of your EA on a chart and try to debug one more?
Reason: