因为有些mt4的市场比较冷门,无法下载到tick数据,福汇倒是有tick数据下载,但是要支付1400美元买权限,杜卡斯倒是有,但是没有冷门市场,于是打算自己折腾一个,搞了两个晚上终于搞出来了。下面是mql源代码:
//+------------------------------------------------------------------+
//| 写入文件.mq4 |
//| Copyright 2018, MetaQuotes Software Corp. |
//| https://www.eait.co|
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link "https://www.eait.co"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
int start()
{
Print(Ask,Bid);
//---
int
handle;
string
myText = "mP"+"y1"+".txt";
datetime timey = Year();
string timeyear = TimeToStr(timey);
datetime timed = Day();
string timeday = TimeToStr(timed);
datetime timem = Month();
string timemonth = TimeToStr(timem);
string timew = timeyear+". "+ timemonth +"."+ timeday;
Print(timew);
handle
=FileOpen(myText,FILE_CSV|FILE_READ|FILE_WRITE,',');
if(handle
<1){
Print("不能打开文件错误-",GetLastError());
}
//FileWrite(handle, "MyNewFile", "aaa", Open[1], High[1], Low[1]);
{
FileSeek(handle, 0, SEEK_END);
//---- add data to the end of file
FileWrite(handle,timeday, Ask,Bid);}
//----------------------------------------------------------
FileClose(handle);
return(0);
}
//+------------------------------------------------------------------+
然后把EA部署在服务器上或者vps上,虽然能弄来一个多月或者一年的数据,但是对于tick交易出现的高重复性也算是够了。
本文原创,转载注明出处。www.eait.co