Optimization by script - hmmm?? - page 2

 
  1. I previous posted the image that showed service desk works fine. Here is another. Click on new request and I see this:

  2. Within a longer loop of an indicator I put a IsStopped() which does not work! I can either kill the terminal or wait until the loop is finished - what is "unintelligible"? What you just wrote was English. what you previously posted was not: "I places at some IsStopped() but I cannot use them as the chart is greyed..." Can't you see the difference?

  3. Since indicators run in the terminal thread, (this is why indicators can not sleep,) the terminal can not receive any event that could set _StopFlag to stop the indicator. There is nothing wrong.  You must break your long indicator calculation to do updates in multiple ticks, only update the last few bars, or move it to an EA.
 

The png shows what I get AFTER I pressed new request - that why it is fat I guess.

The doc. of IsStopped() does to inform that it is not working within an indicator:

Checks the forced shutdown of an mql4 program.

bool  IsStopped();
 
Returned Value

Returns true, if the _StopFlag system variable contains a value other than 0. A nonzero value is written into _StopFlag, if a 
mql4 program has been commanded to complete its operation. In this case, you must immediately terminate the program, otherwise 
the program will be completed forcibly from the outside after 3 seconds.

Beside this I now have the sneaking suspicion that if a loop in an indicator lasts too long this indicator is started again (and again and again and ..) despite I want it to disappear:

int OnCalculate(..) {
   ...
   for(int i=100;i>0;i--){
      for(int j=100;j>0;j--) {
         for(int k=100;k>0;k--) {
            ....  // here is a calculation that takes ~0.5 seconds per loop
            ....  // 1400 loops with 9:13 finishes correctly
            ....  // as I now wanted more it never stops 
   }  }  }
   Comment("show results..");
   PlaySound("alert2");
   ChartIndicatorDelete(0,ChartWindowFind(),ShortName); // this I heard now 3/4 times..
}

Within the last 3 hours I have heard this "alert2.wav" at least 4 times - but the terminal is still greyed, not responsive and working constantly at 100% on one kernel - fantastic.

I need to watch the birds - but it's too dark I guess :(

I now can confirm the indicator's endless loop even with the new build b794 dtd Apr. 28, 2015.

The same loop end as planed after 5:10 min and 9:13 min!

But now I heard my (changed) loop-end signal (PlaySound("coin-drop-1.wav"); - not to mix it with original mt4-signals)

5 times at 21:33. 21:53, 22:14, 22:34 22:55 and still the terminal is grey, not responsive and 1 kernel constantly at 100%

So if the loops are running at least 21 min or more the function ChartIndicatorDelete(..) doesn't work any more :(

But there is nothing in any of the two log files between the start of the looping indicator and it killing.

I have to kill it again - Good Night and Good Luck.

 
gooly:

The png shows what I get AFTER I pressed new request - that why it is fat I guess.

The doc. of IsStopped() does to inform that it is not working within an indicator:

  1. You stated that there is no formating. I proved you wrong. Your statement was false.
  2. The documents are also unclear why indicators can't sleep and must return. I answered why you request doesn't work.
  3. The terminal works the way it works, not the way you think it should. Change your way of thinking.
Reason: