Run script each XX minutes

 

Hello!

I search for a solution to run script after each XXminutes (XX = 10, 15, 30).

The one I have for now works as designed but only once. Next time I want to run it, I should hit Hot-Key or click a mouse. I would like to run it automatically. The Script writes some data into a csv file (quotes, tech indicators, open positions).

I am aware of Expert Advisers that run on each tick, but unfortunately my script when inserted into start() function of Expert Adiser doesn't produce any result (file is not being updated), beside I would like to write to a file only after a period is passed, not constantly. (that is because I am going to access the file from another application)

Could anyone kindly advice?

Thank you very much indeed!

 

Run it inside a while loop, and Sleep( XXminutes*60*1000); before the next iteration.

int start(){

   while(!IsStopped()){

      ... run your script code here

      Sleep( XXminutes*60*1000);

   }

   return(0);

} 
Reason: