Force Donwload of History

 

I need 864000 bars for 1M( 1 month of data) time frame on every paris for my Expert to work corectly, I can get the history just pressing page up on the select pair, but because I need for every pair I wrote the faloowing expert to force the download of data, but it does not work, any sugestions.


Thank You


//+------------------------------------------------------------------+
//|                                                        _Test.mq4 |



string Memo;
int laststop= 0;


int start()
  {
  int j= 0;
  int  max_bars=864000;
  string    msg="Download Rates for  "+Symbol()+",M1"; Comment (msg);
      for (j=laststop; j<=max_bars; j++) 
      { 
      double x=iClose(Symbol(),0 ,j); 
      int time = iTime(Symbol(),0 ,j-1); 
      
      Comment(StringConcatenate ( "Downloading ,",Symbol(),":",j," Value:",x,"\n","Data Since : ", TimeMonth(time) , " / ", TimeDay( time) ," / ", TimeYear ( time) ),"\n", TimeHour( time), ":",TimeMinute( time)  );    
      
      Sleep(1);  
      
      if(x==0) 
            {
         laststop = j - 1;   
         RefreshRates();
         Sleep(1000);
         x=iClose(Symbol(),0 ,j+40);
         RefreshRates();
         break;
      
            }
       
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+
Files:
test.mq4  1 kb
 
One month -- 20 days -- 28,800 bars
 
OK 28,800 bars my bad, still the when you reach the end of your hisotry, refrerate() does not downloand any data I can`t get the 28,800 bars automaticly
 
RefreshRates() does not download history, it updates current values like Bid and Ask in your trading threads if they are stale.
 

I just had a similar issue of download the complete history for any symbol from any chart.


You have to use ArrayCopySeries,analyze their example, and incorporate into your code!

 
c0d3:

I just had a similar issue of download the complete history for any symbol from any chart.


You have to use ArrayCopySeries,analyze their example, and incorporate into your code!

Thank You,


But it does not work, any one know how to send the page up key press via the expert, or any ther sugestion on how to force the donwload of history data


Sinceraly


Pablo

 

Hi i use this to force download since it is written:


double iLow( string symbol, int timeframe, int shift)
Returns Low value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.

For the current chart, the information about low prices is in the predefined array named Low[].



for(int e=0;e<5; e++)
   {
   if(iLow(Symbol(),TimeFrame,e)==0){
      Print("local history for M"+TimeFrame+" is empty. Trying to load now");
      for(int a=0;a<2; a++)
      {Sleep(3000); if(iLow(Symbol(),TimeFrame,e)!=0){Print("local history for M"+TimeFrame+" loaded"); break;}}}
   } 

So attempting to read from history triggers automaticly download i think. You can do this loop for all bars you need but i asume that all history is loaded this way....

 
Thank You But it does not work also
Reason: