Trapping an Abnormal termination/timeout message - page 3

 
jacques366:
...

It's a bit senseless to provide a piece of code as it's part of a complex program and not just a few lines of code.

  


 

I don't ask your code (the one from your complex program). I ask a code to reproduce the issue. If you want to check to exact cause you need to isolate it. If you create a simple EA with these lines of code, and close the platform, do you get the error ?
 
Alain Verleyen:
I don't ask your code (the one from your complex program). I ask a code to reproduce the issue. If you want to check to exact cause you need to isolate it. If you create a simple EA with these lines of code, and close the platform, do you get the error ?

The Timeout has disappeared with the instructions in comments (cf my prior post). I let that code running a few days just to be 100% sure. So I am now considering this Timeout occurs due to those lines sometimes when I shutdown the terminal and also when I have at least 7 charts open with an instance of the EA running on each (I do not have accounts at work with less charts). So I don't have to worry any longer for, just have to proceed to your suggestion to know if this comes from those ChartFirst, ChartNext instructions by themselves or from the interaction with my program...

Platform version: MT4  v4.00 build 1010 (18 Aug 2016)

I'll keep you inform... 

 

To summarize and conclude:

I confirm that the shutdown by timeout during the phase of shutting down the terminal is generated by the following instructions. Each impacted terminal had 7 charts open with an instance of the EA running on each chart. Platform version: MT4  v4.00 build 1010 (18 Aug 2016).

chartOpen = false;
long currChart = ChartFirst();
while(currChart>0)
   {if (ChartSymbol(currChart) == OOrderSymbol[curOrder])          
       {chartOpen = true;
        break;
       }
    currChart=ChartNext(currChart);
   }  

After putting those lines in comments and replacing them by a hard coded test (see prior post at the bottom of page 2)  the error has completely disappeared.

As this error occurs when shutting down the terminal there may be something going wrong with the instruction ChartFirst()or ChartNext().It was the first time I needed to use them.

Someone from Metaquotes can take notice of that.

 
jacques366:

Hello there,

I also ran into same Abnormal Termination issue some time ago, I was able to figure out that I called into a loop the number of bars that exceeded the number of bars on the chart, so..., I feel you should check your loops properly, especially where you tried to loop through the bars on the chart. Cheers...