Errors, bugs, questions - page 2933

 
x572intraday:

Caught the error after all, quote from the reference:

Printed in the Journal - got it:

What do I do with it now, where do I go? Am I a bad hand or...?

Are you sure it's supposed to be an assignment

ArraySize(Arr)=0

and not a comparison?

ArraySize(Arr)==0
 
Vitaly Muzichenko:

Surely it should be an assignment

and not a comparison?

So this is not the program code, but the result of the Print in the Terminal Log. And here is the code itself:

   int c=CopyTime(_Symbol,tf,0,1,Arr);
   if(c<1)
   {
      Print("ArraySize(Arr)=",ArraySize(Arr),
            "; copied=",c,
            "; TF=",EnumToString((ENUM_TIMEFRAMES)tf)
            //"; Arr[0]=",Arr[0]
           );
      Print("Error Code = ",GetLastError());
      ResetLastError();
      return;
   }
So it's not me who missed the range of the array, but the long-suffering history is somehow not always supposedly loaded. I always thought that the history is loaded on the left and might be missing when it's not fully loaded. But not enough history on the right side (new bars) - this is nonsense to me! Besides, I have ArraySetAsSeries=false, if it matters at all.
Документация по MQL5: Общие функции / Print
Документация по MQL5: Общие функции / Print
  • www.mql5.com
Print - Общие функции - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
x572intraday:

So this is not the program code, but the result of the Print in the Terminal Log. And here is the code itself:

So it's not me who missed the range of the array, it's the long-suffering history that somehow doesn't always supposedly get loaded. I always thought that the history is loaded on the left side and may not be enough when it's not fully loaded. But not enough history on the right side (new bars) - this is nonsense to me! Besides, I have ArraySetAsSeries=false.

Reads an empty array with nothing in it?

ArraySize(Arr)

Try this

Print("ArraySize(Arr)=",Arr[0],
 
Vitaly Muzichenko:

Reads an empty array with nothing in it?

Try this

I have the output stringArr[0] specifically commented out (see above), because when I try to output it to the Journal it doesn't get to the 4401 error message, but ends up outputting an "array out of range" error.

...I'll smokehttps://www.mql5.com/ru/docs/series/timeseries_access for now, but bloating my code with this code is creepy...
Документация по MQL5: Константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции
Документация по MQL5: Константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции
  • www.mql5.com
Ошибки компиляции - Коды ошибок и предупреждений - Константы, перечисления и структуры - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
x572intraday:

My output stringArr[0] is specially commented out (see above), because when I try to output it to Journal it does not get to error message 4401, but ends up with "array out of range" error.

Forum on trading, automated trading systems and trading strategies testing

Bugs, bugs, questions

Vitaly Muzichenko, 2020.12.31 13:06

Reads empty array with nothing in it?

ArraySize(Arr)

 
Vitaly Muzichenko:

Yes, the array turns out to be empty, i.e. no new bars are copied into it.

 
x572intraday:

Yes, the array turns out to be empty, i.e. no new bars are copied into it.

This is the case with the first query

 
Vitaly Muzichenko:

It happens at the first request

It's craziness is thathttps://www.mql5.com/ru/docs/series/timeseries_access mentions Sleep() in the article about loading history in the code. But help for Sleep() says: "Sleep() function cannot be called from custom indicators, because indicators are executed in the interface thread and it should not slow it down". It turns out that I need to load the history in an indicator.

Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
Документация по MQL5: Доступ к таймсериям и индикаторам / Организация доступа к данным
  • www.mql5.com
Организация доступа к данным - Доступ к таймсериям и индикаторам - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
x572intraday:

It's craziness is thathttps://www.mql5.com/ru/docs/series/timeseries_access mentions Sleep() in the article about loading history in the code, but the help for Sleep() says: "Sleep() function cannot be called from custom indicators, because indicators are executed in the interface thread and it must not slow it down". It turns out that I need to load the history in the indicator.

Well, make an exit if the data is not copied

int c=CopyTime(_Symbol,tf,0,1,Arr);
if(c<1) return;

At the next tick everything will be copied and the code will work correctly

 

Hello, I'm testing my robot, after finishing testing I saw a lot of fields with requotes in the Log, what do these message stacks mean and what can I add to the code to prevent them from appearing? Thank you, Happy New Year!

Files:
1.jpg  412 kb
Reason: