MQL4参考 时间序列和指标访问 RefreshRates


Refreshing of data in pre-defined variables and series arrays.

bool  RefreshRates();



Returned value

True if the data updated, otherwise false.


This function is used when Expert Advisor has been calculating for a long time and needs data refreshing. Returns true if data are refreshed, otherwise returns false. The only reason for data cannot be refreshed is that they are the current data of the client terminal.

Expert Advisors and scripts operate with their own copy of history data. Data of the current symbol are copied at the first launch of the expert or script. At each subsequent launch of the expert (remember that script is executed only once and does not depend on incoming ticks), the initial copy will be updated. One or more new ticks can income while the Expert Advisor or script is operating, and data can become out of date.


   int ticket;
      ticket=OrderSend(Symbol(),OP_BUY,1.0,Ask,3,0,0,"expert comment",255,0,CLR_NONE);
         int error=GetLastError();
         //---- not enough money
         if(error==134) break;
         //---- 10 seconds wait
         //---- refresh price data