老师,还有一个代码想请教一下,这个是时间K线剩余时间的源码,我想把这个时间显示在屏幕的右下角,而不是跟随价格摆动,望老师能帮我改一下源代码,谢谢!
#property indicator_chart_window
extern bool 跟随价格显示 = TRUE;
extern color 跟随显示颜色 = Yellow;
extern bool 左上角固定显示 = FALSE;
extern color 固定显示颜色 = Blue;
int init() {
return (0);
}
int deinit() {
if (ObjectFind("time") != -1) ObjectDelete("time");
if (ObjectFind("LeftTime") != -1) ObjectDelete("LeftTime");
return (0);
}
int start() {
int l_ind_counted_0 = IndicatorCounted();
int li_12 = Time[0] + 60 * Period() - TimeCurrent();
double ld_4 = li_12 / 60.0;
int li_16 = li_12 % 60;
li_12 = (li_12 - li_12 % 60) / 60;
if (跟随价格显示) {
if (ObjectFind("time") != -1) ObjectDelete("time");
ObjectCreate("time", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
ObjectSetText("time", " <--" + li_12 + ":" + li_16, 13, "Verdana", 跟随显示颜色);
ObjectMove("time", 0, Time[0], Close[0] + 0.0005);
}
if (左上角固定显示) {
if (ObjectFind("LeftTime") != -1) ObjectDelete("LeftTime");
ObjectCreate("LeftTime", OBJ_LABEL, 0, 0, 0);
ObjectSet("LeftTime", OBJPROP_XDISTANCE, 10);
ObjectSet("LeftTime", OBJPROP_YDISTANCE, 20);
ObjectSetText("LeftTime", "当前K线剩余时间: " + li_12 + ":" + li_16, 10, "宋体", 固定显示颜色);
}
return (0);
} |