Download MetaTrader 5

error 'Low' - arrays are passed by reference only

To add comments, please log in or register
Manage agents in your profile. It is easy!
pragma64
24
pragma64 2016.11.28 10:16 

hello, when i compil this code i have an error that i don t understand : 'Low' - arrays are passed by reference only   


void minimum(double Low [], int count)
{
 

  double min = Low[0];
 
  for (int i = 1; i < count; i++)
  {
   
 
    if (min > Low[i])
      min = Low[i];

  }

thanks for your help

Keith Watford
Moderator
9623
Keith Watford 2016.11.28 10:30  

Assuming that this is mql4 there is no need to pass it to the function

void minimum(int count)

If an array is passed by reference

void minimum(double &Low [], int count)
But it cannot be the same name as one of the predefined variables/arrays
pragma64
24
pragma64 2016.11.28 17:57  

thank you you solved my problem but it is nit finished yet



 {
 double Low[];
int count=8;   // number of elements to copy
ArraySetAsSeries(Low,true);
CopyLow(_Symbol,PERIOD_H1,0,count,Low); //la periode est de 1h
//--- return value of prev_calculated for next call


  
   double High [];
   
ArraySetAsSeries(High,true);
CopyHigh(_Symbol,PERIOD_H1,0,count,High);error}      

     


')' - not all control paths return a value   

Keith Watford
Moderator
9623
Keith Watford 2016.11.29 10:02  

Please use the SRC button when posting code. I have done it for you this time.

There is no return in your code

//--- return value of prev_calculated for next call
   //Is normally followed by
   return(rates_total);
  }
To add comments, please log in or register