kenlistian

勤学多思

  IT博客 :: 首页 :: 新随笔 ::  :: 聚合  :: 管理 ::
  412 随笔 :: 0 文章 :: 23 评论 :: 0 Trackbacks

MQL4提供了几种获取信息的方法。

1."Alert" 会出现一个对话窗口显示用户指定数据。 Alert("FreeMargin grows to ", AccountFreeMargin(), "!");

2. "Comment"将会在图表窗口的左上角显示用户指定的数据。 Comment("FreeMargin is ", AccountFreeMargin(), ".");


3."Print"在系统日志中打印用户指定的数据。

Print("FreeMargin is ", AccountFreeMargin(), ".");

或单独打印到文件中 int h1; h1 = FileOpen("ttt.csv", MODE_CSV | MODE_WRITE, ";");

if(h1 < 0) { Print("Unable to open file my_data.csv"); return(false);

}  

//把测试结果放入到文件中 FileWrite(h1, High[1], Low[1], Close[1], Volume[1]);

FileClose(h1);


4.错误的获取用"GetLastError"的功能。


如下 int iTickNum = 0; int iLastError = 0;  

...

iTickNum = OrderSend(Symbol(), OP_BUY, g_Lots, Ask, 3, 0, Ask + g_TakeProfit * g_Points);  

if(iTickNum <= 0) {

iLastError = GetLastError();

if(iLastError != ERR_NO_ERROR)

Alert("Some Message");




posted on 2011-01-15 10:09 kenlistian 阅读(322) 评论(0)  编辑 收藏 引用 所属分类: Base