Download MetaTrader 5
To add comments, please log in or register
We have launched Spanish and Portuguese versions of the website. Try them!
bah12ram
76
bah12ram 2016.10.22 12:12 


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:
Marco vd Heijden
Moderator
4505
Marco vd Heijden 2016.10.22 13:05  

every 3 minutes isn't infinite.

if you want an endless loop you can use

while()
loop
bah12ram
76
bah12ram 2016.10.22 15:18  
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 .

Marco vd Heijden
Moderator
4505
Marco vd Heijden 2016.10.22 16:35  
Please put the screenshot function in OnTimer() function and set it to 3 min.
bah12ram
76
bah12ram 2016.10.23 10:47  
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
bah12ram
76
bah12ram 2016.10.23 15:56  
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.
/
To add comments, please log in or register