Discusión sobre el artículo "Distribuciones Estadísticas en MQL5: tomando lo mejor de R" - página 14

 

Foro sobre negociación, sistemas automatizados de negociación y ensayo de estrategias de negociación

Ayuda con la correlación

Quantum, 2016.12.01 12:53 pm.

Math.mqh archivo debe ser puesto en terminal_data_folder\MQL5\Include\Math\Stat\ carpeta.

No compila bajo MT4. #property strict no ayuda

'Math.mqh'      Math.mqh        1       1
'MathLog1p' - no one of the overloads can be applied to the function call       Math.mqh        4655    17
'MathLog1p' - no one of the overloads can be applied to the function call       Math.mqh        4676    16
'MathExpm1' - no one of the overloads can be applied to the function call       Math.mqh        4702    17
'MathExpm1' - no one of the overloads can be applied to the function call       Math.mqh        4723    16
'MathSinh' - no one of the overloads can be applied to the function call        Math.mqh        4750    17
'MathSinh' - no one of the overloads can be applied to the function call        Math.mqh        4772    16
'MathCosh' - no one of the overloads can be applied to the function call        Math.mqh        4799    17
'MathCosh' - no one of the overloads can be applied to the function call        Math.mqh        4821    16
'MathTanh' - no one of the overloads can be applied to the function call        Math.mqh        4848    17
'MathTanh' - no one of the overloads can be applied to the function call        Math.mqh        4870    16
'MathArcsinh' - no one of the overloads can be applied to the function call     Math.mqh        4897    17
'MathArcsinh' - no one of the overloads can be applied to the function call     Math.mqh        4919    16
'MathArccosh' - no one of the overloads can be applied to the function call     Math.mqh        4946    17
'MathArccosh' - no one of the overloads can be applied to the function call     Math.mqh        4968    16
'MathArctanh' - no one of the overloads can be applied to the function call     Math.mqh        4995    17
'MathArctanh' - no one of the overloads can be applied to the function call     Math.mqh        5017    16
16 error(s), 0 warning(s)               17      1
¿Bug MQL4?
 
Pregunta para el desarrollador, ¿por qué las funciones matemáticas (en el archivo Math.mqh) no están envueltas en una clase? ¿Quizás funcionen más rápido así?
 

Esta es una librería MQL5 sin soporte MQL4.

Las clases no son necesarias en esta biblioteca matriz.

 
Renat Fatkhullin:

Esta es una libreria MQL5 sin soporte MQL4.

Pero funciona al 99% en MQL4, igual que GraphPlot. Sería 100% si arreglaran el error en MQL4 - ninguna de las sobrecargas se puede aplicar a la llamada de función.
 
El tema de MQL4 y MT4 está cerrado. No habrá movimientos ni mejoras en el mismo.
 
fxsaber:
Pero funciona al 99% en MQL4, igual que GraphPlot. Sería 100% si arreglaran el bug en MQL4 - ninguna de las sobrecargas se puede aplicar a la llamada de función.

He mirado cuidadosamente, pero esto no es un bug de MQL4, ¡sino un bug de MQL5!

//+------------------------------------------------------------------+
//| MathLog1p|
//+------------------------------------------------------------------+
//| La función calcula log(1+x) para los elementos de la matriz.
//||
//| Argumentos:|
//| array[] : Array con valores|
//| resultado[] : Matriz de salida con los valores calculados |
//||
//| Valor de retorno: true si tiene éxito, en caso contrario false ||
//+------------------------------------------------------------------+
bool MathLog1p(const double &array[],double &result[])
  {
   int size=ArraySize(array);
   if(size==0)
      return(false);
//--- preparar array de destino
   if(ArraySize(result)<size)
      if(ArrayResize(result,size)!=size)
         return(false);
//--- calcular valores
   for(int i=0; i<size; i++)
      result[i]=MathLog1p(array[i]);
//---
   return(true);
  }
//+------------------------------------------------------------------+
//| MathLog1p|
//+------------------------------------------------------------------+
//| La función calcula log(1+x) para los elementos de la matriz.
//||
//| Argumentos:|
//| array[] : Array con valores|
//||
//| Valor de retorno: true si tiene éxito, en caso contrario false ||
//+------------------------------------------------------------------+
bool MathLog1p(double &array[])
  {
   int size=ArraySize(array);
   if(size==0)
      return(false);
//--- calcular valores
   for(int i=0; i<size; i++)
      array[i]=MathLog1p(array[i]);
//---
   return(true);
  }

MQL4 calla correctamente - ninguna de las sobrecargas se puede aplicar a la llamada ala función. Pero MQL5 se calla cuando hay un error obvio. @Renat Fatkhullin, ¿un bug?

 
fxsaber:
MQL4 advierte correctamente - ninguna de las sobrecargas se puede aplicar a la llamada ala función. Y MQL5 guarda silencio cuando hay un error obvio.

Esto no es un error. MQL5 tiene estas funciones.


 
Quantum:

Esto no es un error. MQL5 tiene estas funciones.

Gracias. Y yo, como un tonto, pulse ALT + G....
 

Hola,
he encontrado un problema al calcular el cuantil de la distribución gamma
en R:
> qgamma(0.05,2,scale=1)
[1] 0.3553615
> qgamma(0.05,10,scale=1)
[1] 5.425406

en mql5:

#include <Math\Stat\Gamma.mqh>
void OnStart()
  {
   int ner;
   double q=MathQuantileGamma(0.05,2,1,ner);
   if(!MathIsValidNumber(q)) {Print("Error ",ner); return;}
   Print(q);
   q=MathQuantileGamma(0.05,10,1,ner);
   if(!MathIsValidNumber(q)) {Print("Error ",ner); return;}
   Print(q);
  }

Resultados:
0.3553615106986621
Error 4

build 1596

 
Alexey Nikolaev:

Hola,
ha encontrado un problema al calcular el cuantil de la distribución gamma

Buenas tardes, gracias por su mensaje.

El error 4 significa problemas de convergencia en el algoritmo de iteración inversa de Newton, que se utiliza para hallar los cuantiles. Lo investigaremos.