Download MetaTrader 5

CopyRates crash with MT4 build 670

To add comments, please log in or register
Use the Pocket to paste your content. It is convenient!
Ex Ovo Omnia
3148
Ex Ovo Omnia 2014.08.31 14:56 

I encounter problems with CopyRates on MT4. Could someone give me a clue, where the problem is? 

When I attach an indicator to a chart, the indicator crashes on CopyRates command, producing this expert tab output: 

14:32:59 Access violation write to 0x00000005
14:32:59 RangeNoGapBar RUSSELL2000,H4: initialization failed (-1)
14:32:59 RangeNoGapBar RUSSELL2000,H4: uninit reason 8
14:32:59 Custom indicator RangeNoGapBar RUSSELL2000,H4: removed

 But it does not crash on the first pass of the command, but rather it crashes casually and only with particular symbols. The code seems clear, and I added trace messages to locate the problem. But nothing seems wrong with the pass which crashes after Access violation write.

The relevant code bit is attached, as well as the ending of the indicator tracing file.

      ResetLastError();
      MqlRates candles[];
      ArraySetAsSeries(candles, true);
      TRACE("CopyRates(" + symbolName +","+tf+","+fromTime+","+toTime+")");      
      int  candleCount = CopyRates(symbolName,tf,fromTime,toTime,candles);

 Trace ends with this line:

2014.08.31 14:32:59    >>(CopyRates(RUSSELL2000,15,2014.08.29 14:30:00,2014.08.29 14:59:59))

Ex Ovo Omnia
3148
Ex Ovo Omnia 2014.09.01 14:13  

Ok, forget the issue, I overloaded the command by a custom method using ArrayCopyRates and ArrayCopy, and so far it seems stable.

Just avoid CopyRates, it is a time bomb.

To add comments, please log in or register