EA Polling

 

New Member, 

How can I setup an EA to Re-calculate or update only every (n_seconds). Not on a Tick basis? 

 
cbal6:

New Member, 

How can I setup an EA to Re-calculate or update only every (n_seconds). Not on a Tick basis? 

Actually it's a bad idea to calculate every n second. Even in just 1 second price may change direction far far away from its latest position which is 1 second before. 

int start()
  {

  while (IsStopped() == false)
     {
 
     //--- put the code here

     Sleep (1000);   // sleep 1000 milliseconds or equal with 1 second  
     RefreshRates(); // don't forget to add this so the data is updated on every loop - Thanks to WHRoeder (see below)

     }

  return (0);
  }
 
sleep(); RefreshRates();
 
WHRoeder:
sleep(); RefreshRates();

You're right, I need that coffee.