PDA

View Full Version : [Excel]如何用实时数据存储时间?



piedlaa
09-18-2015 05:11, 05:11 AM
1附件如果已经回答,我事先道歉,如果情况确实如此,请指出正确的方向。我已经设法使用xlsgate存储BID和ASK价格。每当价格发生变化时,我都很难添加时间戳。如何将其编码到mqlexcel中?

我绝不是一个程序员,如果你愿意的话,我几乎不是一个剧本。如果这段代码看起来像垃圾,我提前道歉。
这是它的样子:

https://www.forex-pedia.com/attachments/1528122827.jpg
插入的代码// --------------------------------------------- --------------------- /| Test1.mq4 |/|版权所有2015,MetaQuotes Software Corp. |/| https://www.mql5.com |/ ----------------------------------------------- ------------------- #property copyright版权所有2015,MetaQuotes Software Corp. #property链接https://www.mql5.com #property版本1.00 #property strict# include lt; xlsgate.mqhgt; extern字符串StartBid = C3; extern字符串StartAsk = D3; bool xlsgateok = false; string StrBid; string StrAsk;/ ----------------------------------------------- ------------------- /|专家初始化功能|/ ----------------------------------------------- ------------------- int OnInit(){StrBid = StartBid; StrAsk = StartAsk; if(ExcelInit(mt4)ExcelStart()){Print(XLSgate init done); xlsgateok = TRUE;打印(Office版本= ExcelVersion()); ExcelSheetAdd(MT4); }/--- return(INIT_SUCCEEDED); }/ ---------------------------------------------- -------------------- /|专家取消初始化功能|/ ----------------------------------------------- ------------------- void OnDeinit(const int reason){//---}/ ------------- -------------------------------------------------- --- /|专家滴答功能|/ ----------------------------------------------- ------------------- double lastBid = 0; double lastAsk = 0; void OnTick(){//--- if(xlsgateok lastBid!= Bid)ExcelSetValue(StrBid,Bid); lastBid =出价; StrBid = ExcelRowAdd(StrBid,1); if(xlsgateok lastAsk!= Ask)ExcelSetValue(StrAsk,Ask); lastAsk =询问; StrAsk = ExcelRowAdd(StrAsk,1); }/ ---------------------------------------------- --------------------
更新1:找到解决方案。令人讨厌的编码,但它的工作原理
https://www.forex-pedia.com/attachments/1528122828.png