程序端
MQL5
MetaTester
MetaEditor
修复崩溃日志中报告的错误。
程序端
MQL5
double vector.RegressionError(const enum lr_error); double matrix.RegressionError(const enum lr_error); vector matrix.RegressionError(const enum lr_error,const int axis);以下变量可用作度量指标:
enum REGRESSION_ERROR { REGRESSION_MAE, // 平均绝对误差 REGRESSION_MSE, // 均方差 REGRESSION_RMSE, // 均方根误差 REGRESSION_R2, // R平方 REGRESSION_MAPE, // 平均绝对百分比误差 REGRESSION_MSPE, // 均方百分比误差 REGRESSION_RMSLE // 均方根对数误差 };
MetaEditor
Tester
程序端
程序端
MQL5
void OnStart() { int arr[4][5]= { {22, 34, 11, 20, 1}, {10, 36, 2, 12, 5}, {33, 37, 25, 13, 4}, {14, 9, 26, 21, 59} }; ulong indexes[4][5]; //--- 排序数组 arr.ArgSort(indexes,-1,0); Print("indexes"); ArrayPrint(indexes); } // 结果日志: // 索引 // [,0][,1][,2][,3][,4] // [0,] 4 2 3 0 1 // [1,] 2 4 0 3 1 // [2,] 4 3 2 0 1 // [3,] 1 0 3 2 4
void OnStart() { string test="some string"; PrintFormat("String length is %d",test.Length()); } // 结果日志: // 字符串长度是11
MQL5
double matrix::Flat(ulong index) const; // getter void matrix::Flat(ulong index,double value); // setter
计算矩阵元素地址的伪代码:
ulong row=index / mat.Cols(); ulong col=index % mat.Cols(); mat[row,col]
例如,对于'matrix mat(3,3)',访问元素可以按如下写出:
Tester
程序端
程序端
MQL5
VPS
MetaEditor
Tester
>
更新文档。
struct POINT { int x,y; }; int GetYFunc(y) { return(y * y); } void SomeFunction(int x1,int x2,int y) { POINT pt={ x1+x2, GetYFunc(y) }; ProcessPoint(pt); };
struct complex { double real; // 实数部分 double imag; // 虚数部分 };“复数”类型可以作为MQL5函数的参数按值传递(与普通结构不同,普通结构只通过引用传递)。对于从DLL导入的函数,“复数”类型只能通过引用来传递。
complex square(complex c) { return(c*c); } void OnStart() { Print(square(1+2i)); // 常量作为参数传递 } // "(-3,4)"将被输出,这是复数的字符串表示目前,复数只有简单的运算可用:=、+、-、*、/、+=、-=、*=、/=、==、!=。
select count(*) as book_count, cast(avg(parent) as integer) as mean, cast(median(parent) as integer) as median, mode(parent) as mode, percentile_90(parent) as p90, percentile_95(parent) as p95, percentile_99(parent) as p99 from moz_bookmarks;
void func(int &arr[ ][ ][ ][ ]) { }
struct MyStruct { string Array[]; }; void OnStart() { MyStruct a1,a2; ArrayResize(a1.Array,3); ArrayResize(a2.Array,1); a1=a2; }之前,"a1"数组大小在函数调用后等于3。现在,这个数组大小将为1。
文档已更新。
ENUM_FP_CLASS MathClassify( double value // 实数 );该枚举包括以下值:
if(MathClassify(value)>FP_ZERO) { Print("value is not a valid number"); }