Copy functions return in tester

 
if(TimeFrame==PERIOD_M1)
{
        Hcopied = CopyHigh(_Symbol, PERIOD_M1, 0, 5, M1_Bars_High);
        Lcopied = CopyLow(_Symbol, PERIOD_M1, 0, 5, M1_Bars_Low);
        Ocopied = CopyOpen(_Symbol, PERIOD_M1, 0, 5, M1_Bars_Open);
        Ccopied = CopyClose(_Symbol, PERIOD_M1, 0, 5, M1_Bars_Close);
        if(Hcopied+Lcopied+Ocopied+Ccopied != 20)
        {
                Print("M1 bar data retrieval failure...");
                return false;
        }
}
Hi, in tester (No visualization) that nested if is always true. (since Hcopied+Lcopied+Ocopied+Ccopied always = -4)
So, Copy functions always return -1;

WHY ?

these whole code is inside OnTick(), the EA is works in multi-TF , if that matters.

Also, where can i see the journal (where all EA logs are printed to) in Visualization mode ?
Do I need to disable fail checks of Copy functions, for backtesting ?
 
Code2219 or probably 2319:
Hi, in tester (No visualization) that nested if is always true. (since Hcopied+Lcopied+Ocopied+Ccopied always = -4)
So, Copy functions always return -1;

WHY ?

these whole code is inside OnTick(), the EA is works in multi-TF , if that matters.

Also, where can i see the journal (where all EA logs are printed to) in Visualization mode ?
Do I need to disable fail checks of Copy functions, for backtesting ?
You ALWAYS need to check for errors. Copyxxx function returns an error only if value is -1, it could also return "4" even if you asked 5 values. What is the error code returned ?
 
Alain Verleyen:
You ALWAYS need to check for errors. Copyxxx function returns an error only if value is -1, it could also return "4" even if you asked 5 values. What is the error code returned ?
thanks to mention the error code, it was my mistake. (didn't resize my target array before copy, so my target was smaller than requested number of values.)
Solved
 
double M1_Bars_High[],  M1_Bars_Low[], M1_Bars_Open[], M1_Bars_Close[];
void OnInit()
{
     ArraySetAsSeries(M1_Bars_High, true);
     ArraySetAsSeries(M1_Bars_Low, true);
     ArraySetAsSeries(M1_Bars_Open, true);
     ArraySetAsSeries(M1_Bars_Close, true);
}

void OnTick()
{
     if( CopyHigh(_Symbol, PERIOD_M1, 0, 5, M1_Bars_High) != 5 )
          return;
     if( CopyLow(_Symbol, PERIOD_M1, 0, 5, M1_Bars_Low) != 5 )
          return;
     if( CopyOpen(_Symbol, PERIOD_M1, 0, 5, M1_Bars_Open) != 5 )
          return;
     if( CopyClose(_Symbol, PERIOD_M1, 0, 5, M1_Bars_Close) != 5 )
          return;
}
Reason: