文章 "MQL5 中的统计分布 - 取最佳的 R" - 页 14

 

关于交易、自动交易系统和测试交易策略的论坛

相关性帮助

Quantum, 2016.12.01 12:53 pm.

Math.mqh 文件应该放在 terminal_data_folder\MQL5\Include\Math\Stat\ 文件夹中。

它无法在MT4下编译。#property strict does not help

'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
MQL4 bug?
 
请问开发人员,为什么数学函数(在Math.mqh 文件中)不封装在一个类中?也许这样运行得更快?
 

这是一个不支持 MQL4 的 MQL5 库。

该矩阵库不需要类。

 
Renat Fatkhullin:

这是一个 MQL5 库,不支持 MQL4。

但它 99% 可以在 MQL4 中运行,就像 GraphPlot 一样。如果他们修复了 MQL4 中的错误,那么它将 100% 运行--所有重载都无法应用于函数调用
 
MQL4 和 MT4 的主题已关闭。不会有任何变动或改进。
 
fxsaber:
但它在 MQL4 中 99% 有效,就像 GraphPlot 一样。如果他们修复了 MQL4 中的错误--所有重载都不能应用于函数调用,那么它就能 100% 工作。

我仔细查看过,但这不是 MQL4 的错误,而是 MQL5 的错误!

//+------------------------------------------------------------------+
//| MathLog1p|
//+------------------------------------------------------------------+
//| 函数计算数组元素的 log(1+x) 值。
//||
//| 参数:|
//| array[] :包含值的数组|
//| result[] : 包含计算值的输出数组
//||
//} 返回值:成功则为 true,否则为 false
//+------------------------------------------------------------------+
bool MathLog1p(const double &array[],double &result[])
  {
   int size=ArraySize(array);
   if(size==0)
      return(false);
//--- 准备目标数组
   if(ArraySize(result)<size)
      if(ArrayResize(result,size)!=size)
         return(false);
//--- 计算数值
   for(int i=0; i<size; i++)
      result[i]=MathLog1p(array[i]);
//---
   return(true);
  }
//+------------------------------------------------------------------+
//| MathLog1p|
//+------------------------------------------------------------------+
//| 函数计算数组元素的 log(1+x) 值。
//||
//| 参数:|
//| array[] :包含值的数组|
//||
//} 返回值:成功则为 true,否则为 false
//+------------------------------------------------------------------+
bool MathLog1p(double &array[])
  {
   int size=ArraySize(array);
   if(size==0)
      return(false);
//--- 计算数值
   for(int i=0; i<size; i++)
      array[i]=MathLog1p(array[i]);
//---
   return(true);
  }

MQL4 可以正确地骂人--没有一个重载可以应用到 函数调用中。@Renat Fatkhullin,错误?

 
fxsaber:
MQL4 正确地发出了警告--没有一个重载可以应用于 函数调用。而 MQL5 则在出现明显错误时保持沉默。

这不是错误。MQL5 有这些函数。


 
Quantum:

这不是错误。MQL5 具有这些功能。

谢谢!我像个傻瓜一样按下 ALT+G....
 

您好,
,在 R 中计算伽马分布的量值时遇到了一个问题
:
> qgamma(0.05,2,scale=1)
[1] 0.3553615
> qgamma(0.05,10,scale=1)
[1] 5.425406

,在 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);
  }

结果:
0.3553615106986621
错误 4

build 1596

 
Alexey Nikolaev:

你好,
在计算伽马分布的量值时遇到了一个问题

下午好,感谢您的留言。

错误 4 意味着牛顿反向迭代算法中的收敛问题,该算法用于查找量值。我们将对此进行研究。