MQL5 5.0 build 2783 bug? // 'ArrayMinimum' - constant cannot be modified

 

Hi

maybe buy?

I get compiler error on:

            Min_Bar=ArrayMinimum(mrateMesec,0,WHOLE_ARRAY);
            Maks_Bar=ArrayMaximum(mrateMesec,0,WHOLE_ARRAY);

 'ArrayMinimum' - constant cannot be modified


Please check code in file test2.mq5

Files:
test2.mq5  416 kb
 

What about reading the documentation ?

array[]

[in]  A numeric array, in which search is made.

Documentation on MQL5: Array Functions / ArrayMinimum
Documentation on MQL5: Array Functions / ArrayMinimum
  • www.mql5.com
ArrayMinimum - Array Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

you can't get min or max of Mql Rates arrays like this, first copy closes or opens or what ever you want to get min or max for to an array then run these functions

 

yes...you have right!

Thanks to all!

int   PozicijaSIGNALA_MN1_proc()
   {
      int   po=50;
      int   Min_Bar,Maks_Bar;

      double   Minimalni;
      double   Maksimalni;
      MqlRates mrateMesec[];          // To be used to store the prices, volumes and spread of each bar   

      double   maxArray[];
      double   minArray[];
      
      ArraySetAsSeries(mrateMesec,true);
      ArraySetAsSeries(maxArray,true);
      ArraySetAsSeries(minArray,true);
      ArrayCopy(maxArray,mrate);
      
      int   copied=CopyRates(_Symbol,PERIOD_MN1,0,_BAR8x_,mrateMesec);
      if(copied<0)
         {
            Alert("Error copying Month rates/history data - error:",GetLastError(),"!!");
            return(false);
         }
        else
         {
            ArrayResize(maxArray,_BAR8x_);
            ArrayResize(minArray,_BAR8x_);
            for(int i=0;      i<_BAR8x_;    i++)
              {
               maxArray[i]=mrateMesec[i].high;
               minArray[i]=mrateMesec[i].low;
              }
            Min_Bar=ArrayMinimum(minArray,0,WHOLE_ARRAY);
            Maks_Bar=ArrayMaximum(maxArray,0,WHOLE_ARRAY);
            if(Min_Bar>-1  && Maks_Bar>-1)
              {
               Minimalni=minArray[Min_Bar];
               Maksimalni=maxArray[Maks_Bar];
               po=(int)((SignalSREDNJA-Minimalni)* 100/(Maksimalni-Minimalni));
              }
         }
      return(po);
   }
Reason: