infinite loop

 


how can I  change this Code to cause an infinite loop within my Script every 3 Minutes:

//+------------------------------------------------------------------+

//|                                                   screentest.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
int x;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {do
  {

  for(x=1;x<=7000; x++);
int lasterror=0;

    {
     //---- make WindowScreenShot for further checking
     if(!WindowScreenShot("shots\\tester"".gif",640,480))
        lasterror=GetLastError();
    
      Sleep(3000);
                
    }
   }
   while(x<=7000);
   return;
  }
//+------------------------------------------------------------------+
how can I  change this Code to cause an infinite loop within my Script every 3 Minutes:
 

every 3 minutes isn't infinite.

if you want an endless loop you can use

while()
loop
 
Marco vd Heijden:

every 3 minutes isn't infinite.

if you want an endless loop you can use

while()


thanks;

if I use " while() " I get this Error: 'while' - expression expected    screentest.mq4    31    4

I want every 3 minutes take one screenshot and save it as tester.gif and overwrite last tester.gif .

 
Please put the screenshot function in OnTimer() function and set it to 3 min.
 
Marco vd Heijden:
Please put the screenshot function in OnTimer() function and set it to 3 min.

thanks a lot;

I read in Documentation "The OnTimer() function is called when the Timer event occurs, which is generated by the system timer only for Expert Advisors and indicators - it can't be used in scripts."

I don't know how to " put the screenshot function in OnTimer() function and set it to 3 min." is there an other possibility to do that in my Script? 

 

Client Terminal Events - MQL4 programs - MQL4 Reference
Client Terminal Events - MQL4 programs - MQL4 Reference
  • docs.mql4.com
Client Terminal Events - MQL4 programs - MQL4 Reference
 
Marco vd Heijden:
Please put the screenshot function in OnTimer() function and set it to 3 min.
thanks a lot, I have found the Solution.