Interesting problem

Anti Lippasaar
255
Anti Lippasaar  
Using the following code i am trying to download as much history i can or 3000 bars from this moment is downloaded.

int init()
{
   
   string paar[] = {"AUDCAD.arm", "AUDCHF.arm" ,"AUDJPY.arm" ,"AUDNZD.arm" ,"AUDUSD.arm" ,"CADCHF.arm" ,"CADJPY.arm" ,"CHFJPY.arm" ,"EURAUD.arm" ,"EURCAD.arm"
       ,"EURUSD.arm" ,"EURCHF.arm" ,"EURGBP.arm" ,"EURJPY.arm" ,"EURNOK.arm" ,"EURNZD.arm" ,"EURPLN.arm" ,"EURSEK.arm" ,"EURTRY.arm" ,"GBPAUD.arm"
       ,"GBPCAD.arm" ,"GBPCHF.arm" ,"GBPJPY.arm" ,"GBPNZD.arm" ,"GBPPLN.arm" ,"GBPUSD.arm" ,"NZDCAD.arm" ,"NZDCHF.arm" ,"NZDJPY.arm" ,"NZDUSD.arm"
       ,"USDNOK.arm" ,"USDCAD.arm" ,"USDCZK.arm" ,"USDDKK.arm" ,"USDHUF.arm" ,"USDSEK.arm" ,"USDCHF.arm" ,"USDJPY.arm" ,"USDMXN.arm" ,"USDPLN.arm"
       ,"USDSGD.arm" ,"USDTRY.arm" ,"EURCZK.arm" ,"EURDKK.arm" ,"EURHKD.arm" ,"EURHUF.arm" ,"EURMXN.arm" ,"EURSGD.arm" ,"EURZAR.arm" ,"GBPCZK.arm"
       ,"GBPDKK.arm" ,"GBPHKD.arm" ,"GBPHUF.arm" ,"GBPNOK.arm" ,"GBPSEK.arm" ,"GBPTRY.arm" ,"GBPZAR.arm" ,"NZDSGD.arm" ,"USDHKD.arm" ,"USDZAR.arm"
       ,"XAGUSD.arm" ,"XAUUSD.arm"  };
   
   double ma1 = 0;
   
   for(int u=0; u<ArraySize(paar); u++)
   {  
      for(int k=1; k<3000 ;k=k+100)
      {
         ma1 = iHigh(paar[u], 5, k);
         ma1 = iHigh(paar[u], 15, k);
         ma1 = iHigh(paar[u], 30, k);
         ma1 = iHigh(paar[u], 60, k);
         ma1 = iHigh(paar[u], 240, k);
         ma1 = iHigh(paar[u], 1440, k);
         ma1 = iHigh(paar[u], 10080, k);
         ma1 = iHigh(paar[u], 43200, k);
      }
      Print("Tehtud sai ",paar[u]);
   }
}

int start()
{
}
If i delete all my previous history files it works great. To make sure it works great, sometimes i use "Sleep(10000)" inside the second for loop to ensure enough time for downloading information.
Like i said, it works without problems.

But if i already have history files in the folder it dose not work so great. From 1 minute to weekly i have roughly 8 months of history of 62 currency pairs.
When i have this history in my history folder and run this EA, MT4 always crashes. I have tried several things, i tried to add long pauses, i tried to automatically remove EA and re-attach after every currency pair. Nothing worked.
But if i rune the same code i have displayed here and MT4 crashes and i reopen MT4 it magically starts to download all the historical data, but with some mistakes. It download most of history, but not all. Once it only did not download 1 currency pair's 5 minute bars.

I noticed when my MT4 is starting to crash in the connection bar, the upper green one goes light green every time just before the crash. Are there any ideas how i could download all the data without crashing or does anybody have any idea why MT4 crashes?
Simon Gniadkowski
17400
Simon Gniadkowski  
olympus999 :
Using the following code i am trying to download as much history i can or 3000 bars from this moment is downloaded.

If i delete all my previous history files it works great. To make sure it works great, sometimes i use "Sleep(10000)" inside the second for loop to ensure enough time for downloading information.
Like i said, it works without problems.

But if i already have history files in the folder it dose not work so great. From 1 minute to weekly i have roughly 8 months of history of 62 currency pairs.
When i have this history in my history folder and run this EA, MT4 always crashes. I have tried several things, i tried to add long pauses, i tried to automatically remove EA and re-attach after every currency pair. Nothing worked.
But if i rune the same code i have displayed here and MT4 crashes and i reopen MT4 it magically starts to download all the historical data, but with some mistakes. It download most of history, but not all. Once it only did not download 1 currency pair's 5 minute bars.

I noticed when my MT4 is starting to crash in the connection bar, the upper green one goes light green every time just before the crash. Are there any ideas how i could download all the data without crashing or does anybody have any idea why MT4 crashes?
init() is not supposed to run for a long time . . . move your loop to start() and run your code as a script.
Anti Lippasaar
255
Anti Lippasaar  
Did not work. Exactly the same problem, but with script it did not download almost no data at all...
Simon Gniadkowski
17400
Simon Gniadkowski  
olympus999 :
Did not work. Exactly the same problem, but with script it did not download almost no data at all...
Exactly the same problem as ? you described a few failure modes . . . did it crash MT4 ?
William Roeder
25333
William Roeder  
ma1 = iHigh(paar[u], 5, k);
  1. Did you move it out of init?
  2. Did you check for ma1==0 AND GetLastError()=4066
    ERR_HISTORY_WILL_UPDATED4066Requested history data in updating state.
    AND sleep 15 seconds before continuing?
  3. Did you install in \program files* on Vista/7/8?
Anti Lippasaar
255
Anti Lippasaar  
WHRoeder :
  1. Did you move it out of init?
  2. Did you check for ma1==0 AND GetLastError()=4066
    ERR_HISTORY_WILL_UPDATED4066Requested history data in updating state.
    AND sleep 15 seconds before continuing?
  3. Did you install in \program files* on Vista/7/8?

I did 1 and 2 now, worked marvelously. Thank you :)