Automatic history check, download and refresh

Peter  

Hi all,

I'm looking for a solution, maybe someone knows about something...

The ideal will be an EA that I can run everytime I open mt4.
The EA then automatically checks a provided list of instruments if all the data (M1 to H4 for example) is up to date.
The EA then downloads all new data from history center to make 100% sure all the historical data is up to date.
Lastly the data refreshes all the instruments (various timeframes) to make 100% sure every timeframe for every instrument (on selected list) is updated and refreshed.

I always need updated and refreshed data before I start running another EA and do analysis.

Kind Regards,
Peter 

Eleni Anna Branou  
Peter:

Hi all,

I'm looking for a solution, maybe someone knows about something...

The ideal will be an EA that I can run everytime I open mt4.
The EA then automatically checks a provided list of instruments if all the data (M1 to H4 for example) is up to date.
The EA then downloads all new data from history center to make 100% sure all the historical data is up to date.
Lastly the data refreshes all the instruments (various timeframes) to make 100% sure every timeframe for every instrument (on selected list) is updated and refreshed.

I always need updated and refreshed data before I start running another EA and do analysis.

Kind Regards,
Peter 

Try Freelance.

nicholish en  
//+------------------------------------------------------------------+
//|                                    RefreshMarketWatchSymbols.mq4 |
//|                                                      nicholishen |
//|                         https://www.forexfactory.com/nicholishen |
//+------------------------------------------------------------------+
#property copyright "nicholishen"
#property link      "https://www.forexfactory.com/nicholishen"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
   ENUM_TIMEFRAMES tfs[] = {
      PERIOD_M1,  PERIOD_M5, PERIOD_M15,
      PERIOD_M30, PERIOD_H1, PERIOD_H4, 
      PERIOD_D1,  PERIOD_W1, PERIOD_MN1
   };
   for(int i=SymbolsTotal(true)-1; i>=0; --i)
      for(int j=ArraySize(tfs)-1; j>=0; --j)
         while(!IsStopped() && !is_ready(SymbolName(i, true), tfs[j]));
}
//+------------------------------------------------------------------+
bool is_ready(string symbol, ENUM_TIMEFRAMES tf)
{
   ResetLastError();
   int n = iBars(symbol, tf);
   if(GetLastError() != ERR_NO_ERROR || n <= 0){
      Sleep(10);
      return false;
   }
   return true;
}
Peter  
nicholi shen:

Thank you, I'll give it a try!

Lorentzos Roussos  
nicholi shen:

Add a "RefreshRates();" after ResetLastError to make sure it updates

nicholish en  
You only need RefreshRates when using predefined variables/arrays belonging to the symbol and time-frame of the chart you are running on. That's why I'm using iBars...
APursch  

nicholi

Your script is so useful, thank you.

telurdadar2000  

Hi Apursch or nicholi,

i have same problem too.....how to use the script ?