市场解说员 发表于 2019-11-23 18:51:12

MQL4自编指标学习2-Bars iBars() Print()

函数Print()学习

void Print(
argument, // first value
… // next values
);

Parameters
Any values separated by commas. The number of parameters cannot exceed 64.

Note
Arrays cannot be passed to the Print() function. Arrays must be input element-by-element.

例子1
Print("c=",c, "    Pi=",M_PI, "    (float)M_PI=",(float)M_PI);
// c=3.14159    Pi=3.141592653589793    (float)M_PI=3.14159 预定义Bars学习Number of bars in the current chart.
例子2printf(Bars);
   //2018.11.28 10:36:48.160        柱体标号索引学习 EURUSD,H1: 2221
   //2018.11.28 10:35:55.080        柱体标号索引学习 EURUSD,H4: 8031
   //2018.11.28 10:36:26.926        柱体标号索引学习 EURUSD,Daily: 2049
例子3int counter=1;
for(int i=1; i<=Bars; i++)
    {
   Print(Close);
    }
/*
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.12909
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.1313
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.16021
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.16069
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.16898
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.16816
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.1691
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.20767
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.23257
.....
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.1091
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.1334
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.1113
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: 1.0819
0        10:57:08.496        柱体标号索引学习 EURUSD,Monthly: initialized
*/函数iBars()学习
int iBars(string symbol, // symbolint timeframe // timeframe);Parameterssymbol Symbol the data of which should be used to calculate indicator. NULL means the current symbol.timeframe Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.Returned valueThe number of bars on the specified chart.例子4rint("Bar count on the 'EURUSD,H1' is ",iBars("EURUSD",PERIOD_H1));
   //2018.11.28 10:38:16.128        柱体标号索引学习 EURUSD,H4: Bar count on the 'EURUSD,H1' is 2221
   //2018.11.28 10:38:37.721        柱体标号索引学习 EURUSD,H1: Bar count on the 'EURUSD,H1' is 2221



页: [1]
查看完整版本: MQL4自编指标学习2-Bars iBars() Print()