Errors, bugs, questions - page 1834

 
 
Andrey Dik:
I don't see a contradiction.
 
transcendreamer:

It may have already been done, but let me ask:

whyPOSITION_COMMISSION is not highlighted and not in the help?


This constant is no longer relevant, but unfortunately we can't reject it. That's why it's left unlit in the compiler

 
fxsaber:
I don't see a contradiction.

Contradiction with what?

I showed a negative balance in the tester. Also, equity was going below zero. I have to assume it's a bug.

 

I don't understand anything, MT5 version 1545. In previous versions there were functions in Math.mqh listing:

//+------------------------------------------------------------------+
//| Computes the minimum value in array[]                            |
//+------------------------------------------------------------------+
double MathMin(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count==0)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- first element by default, find minimum
   double min_value=array[ind1];

   for(int i=ind1+1; i<=ind2; i++)
      min_value=MathMin(min_value,array[i]);
//--- return minimum value
   return(min_value);
  }
//+------------------------------------------------------------------+
//| Computes the maximum value in array[]                            |
//+------------------------------------------------------------------+
double MathMax(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count==0)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- first element by default, find maximum
   double max_value=array[ind1];

   for(int i=ind1+1; i<=ind2; i++)
      max_value=MathMax(max_value,array[i]);
//--- return maximum value
   return(max_value);
  }
//+------------------------------------------------------------------+
//| Computes the range of the values in array[]                      |
//+------------------------------------------------------------------+
double MathRange(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count==0)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- default values, find minimum and maximum values
   double min_value=array[ind1];
   double max_value=array[ind1];

   for(int i=ind1+1; i<=ind2; i++)
     {
      double value=array[i];
      min_value=MathMin(min_value,value);
      max_value=MathMax(max_value,value);
     }
//--- return range
   return(max_value-min_value);
  }
//+------------------------------------------------------------------+
//| Computes the sum of the values in array[]                        |
//+------------------------------------------------------------------+
double MathSum(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count==0)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate sum
   double sum=0.0;
   for(int i=ind1; i<=ind2; i++)
      sum+=array[i];
//--- return sum
   return(sum);
  }
//+------------------------------------------------------------------+
//| Computes the standard deviation of the values in array[]         |
//+------------------------------------------------------------------+
double MathStandardDeviation(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count<=1)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate mean
   double mean=0.0;
   for(int i=ind1; i<=ind2; i++)
      mean+=array[i];
//--- average mean
   mean=mean/data_count;
//--- calculate standard deviation   
   double sdev=0;
   for(int i=ind1; i<=ind2; i++)
      sdev+=MathPow(array[i]-mean,2);
//--- return standard deviation
   return MathSqrt(sdev/(data_count-1));
  }
//+------------------------------------------------------------------+
//| Computes the average absolute deviation of the values in array[] |
//+------------------------------------------------------------------+
double MathAverageDeviation(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count<=1)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate mean
   double mean=0.0;
   for(int i=ind1; i<=ind2; i++)
      mean+=array[i];
   mean=mean/data_count;
//--- calculate average deviation
   double adev=0;
   for(int i=ind1; i<=ind2; i++)
      adev+=MathAbs(array[i]-mean);
   adev=adev/data_count;
//--- return average deviation
   return(adev);
  }
//+------------------------------------------------------------------+
//| Computes the median value of the values in array[]               |
//+------------------------------------------------------------------+
double MathMedian(double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count==0)
      return(QNaN);
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- prepare sorted values
   double sorted_values[];
   ArrayCopy(sorted_values,array,0,start,count);
   ArraySort(sorted_values);
//--- calculate median for odd and even cases
//--- data_count=odd
   if(data_count%2==1)
      return(sorted_values[data_count/2]);
   else
//--- data_count=even
      return(0.5*(sorted_values[(data_count-1)/2]+sorted_values[(data_count+1)/2]));
  }
//+------------------------------------------------------------------+
//| Computes the mean value of the values in array[]                 |
//+------------------------------------------------------------------+
double MathMean(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count<1)
      return(QNaN); // need at least 1 observation
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate mean
   double mean=0.0;
   for(int i=ind1; i<=ind2; i++)
      mean+=array[i];
   mean=mean/data_count;
//--- return mean
   return(mean);
  }
//+------------------------------------------------------------------+
//| Computes the variance of the values in array[]                   |
//+------------------------------------------------------------------+
double MathVariance(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count<2)
      return(QNaN); // need at least 2 observations
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate mean
   double mean=0.0;
   for(int i=ind1; i<=ind2; i++)
      mean+=array[i];
   mean=mean/data_count;
//--- calculate variance
   double variance=0;
   for(int i=ind1; i<=ind2; i++)
      variance+=MathPow(array[i]-mean,2);
   variance=variance/(data_count-1);
//--- return variance
   return(variance);
  }
//+------------------------------------------------------------------+
//| Computes the skewness of the values in array[]                   |
//+------------------------------------------------------------------+
double MathSkewness(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count<3)
      return(QNaN); // need at least 3 observations
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate mean
   double mean=0.0;
   for(int i=ind1; i<=ind2; i++)
      mean+=array[i];
   mean=mean/data_count;
//--- calculate variance and skewness
   double variance=0;
   double skewness=0;
   for(int i=ind1; i<=ind2; i++)
     {
      double sqr_dev=MathPow(array[i]-mean,2);
      skewness+=sqr_dev*(array[i]-mean);
      variance+=sqr_dev;
     }
   variance=(variance)/(data_count-1);
   double v3=MathPow(MathSqrt(variance),3);
//---
   if(v3!=0)
     {
      skewness=skewness/(data_count*v3);
      //--- return skewness
      return(skewness);
     }
   else
      return(QNaN);
  }
//+------------------------------------------------------------------+
//| Computes the kurtosis of the values in array[]                   |
//+------------------------------------------------------------------+
double MathKurtosis(const double &array[],const int start=0,const int count=WHOLE_ARRAY)
  {
   int size=ArraySize(array);
   int data_count=0;
//--- set data count
   if(count==WHOLE_ARRAY)
      data_count=size;
   else
      data_count=count;
//--- check data range
   if(data_count<4)
      return(QNaN); // need at least 4 observations
   if(start+data_count>size)
      return(QNaN);
//--- set indexes
   int ind1=start;
   int ind2=ind1+data_count-1;
//--- calculate mean
   double mean=0.0;
   for(int i=ind1; i<=ind2; i++)
      mean+=array[i];
   mean=mean/data_count;
//--- calculate variance and kurtosis
   double variance=0;
   double kurtosis=0;
   for(int i=ind1; i<=ind2; i++)
     {
      double sqr_dev=MathPow(array[i]-mean,2);
      variance+=sqr_dev;
      kurtosis+=sqr_dev*sqr_dev;
     }
//--- calculate variance
   variance=(variance)/(data_count-1);
   double v4=MathPow(MathSqrt(variance),4);

   if(v4!=0)
     {
      //--- calculate kurtosis
      kurtosis=kurtosis/(data_count*v4);
      kurtosis-=3;
      //--- return kurtosis
      return(kurtosis);
     }
   else
      return(QNaN);
  }

and now they are not in this listing, I looked in other Math directory listings, but I didn't find these functions there either.

Were they removed at all or were they accidentally erased?

 
checked up to version 1554 of MT5, same story, these functions are no longer available
 
luser.2017:
Checked up to version 1554 of MT5, same story, these functions are no longer there
Why do you need them there when you have the whole suite of maths functions.
Документация по MQL5: Математические функции
Документация по MQL5: Математические функции
  • www.mql5.com
Математические функции - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Alexey Viktorov:
Why do you need them there when you have the whole set of mathematical functions.


Before you answer, compare it with the ones I posted in the listing. By the way, these functions are listed in the standard library help, so it's more likely that someone has accidentally erased them.

 
Konstantin:


Before you answer, compare it with the ones I posted in the listing. By the way, these functions are listed in the standard library help, so it's more likely that someone has accidentally erased them.


The answer from servicedesk, data functions from the standard library have been removed purposefully, the issue is resolved. Help should also be brought in line, because time is sometimes wasted searching for something that is no longer in the functionality.
 

How can this be? I open a demo account on one server of the company btc-e.com, but it opens on a completely different server of another company!




Reason: