简单的自定义函数显示K线倒计时,当然你也可以把算法调用到其它函数中,比如K线结束1分钟平仓等。
- void ktime()
- {
- int li_8 = Time[0] + 60 * Period() - TimeCurrent();
- double ld_0 = li_8 / 60.0;
- int li_12 = li_8 % 60;
- li_8 = (li_8 - li_8 % 60) / 60;
- ObjectDelete("time");
- if (ObjectFind("time") != 0) {
- ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
- ObjectSetText("time", " <" + li_8 + ":" + li_12, 16, "Arial", Yellow);
- } else ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
- //-----------------------------------------------------------------------------------
- }
|