記事"R で 統計分布を MQL5 に -"についてのディスカッション - ページ 14

 

取引、自動取引システム、取引戦略のテストに関するフォーラム

相関関係のヘルプ

Quantum, 2016.12.01 12:53 pm.

Math.mqhは terminal_data_folderの中のMQL5IncludeMathStatフォルダに入れる必要があります。

MT4ではコンパイルできません。#property strictは役に立ちません。

'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のバグ?
 
開発者に質問です。(Math.mqh ファイル内の)数学関数はなぜクラスでラップされていないのでしょうか?その方が速く動くのでは?
 

これはMQL4サポートのないMQL5ライブラリです。

このマトリックス・ライブラリにはクラスは必要ありません。

 
Renat Fatkhullin:

これはMQL4サポートのないMQL5ライブラリです。

しかし、GraphPlotのようにMQL4でも99%動作します。もしMQL4のバグが修正されれば100%になるでしょう -関数 呼び出しにどのオーバーロードも適用できません。
 
MQL4とMT4の話題は終了しました。MQL4とMT4の話題は終了しました。
 
fxsaber:
しかし、MQL4ではGraphPlotのように99%動作します。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では、オーバーロードを 関数 呼び出しに 適用することはできません。 しかし、MQL5は明らかなエラーがあっても黙っています

 
fxsaber:
MQL4は正しく警告を発します -関数 呼び出しに オーバーロードを適用することはできません。 そしてMQL5は、明らかなエラーがある場合は沈黙する。

これはエラーではない。MQL5にはこれらの関数があります。


 
Quantum:

これはエラーではない。MQL5にはこれらの関数があります。

ありがとう!そして私は馬鹿の一つ覚えのようにALT+Gを押してしまった...。
 




> 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

ビルド 1596

 
Alexey Nikolaev:


ガンマ分布の分位数を計算する際に問題が発生しました。

こんにちは,メッセージをありがとうございます。

エラー4は、分位数を求めるために使用されるニュートンの逆反復アルゴリズムにおける収束の問題を意味します。調べてみます。