设为首页 收藏本站 切换语言

创建标签脚本

| 发表于 2020-7-20 00:28:45 | 显示全部楼层 |复制链接
  1. int start()
  2.   {
  3.    int i;
  4.    string obj_name="label_object";
  5.    long current_chart_id=ChartID();
  6. //--- creating label object (it does not have time/price coordinates)
  7.    if(!ObjectCreate(current_chart_id,obj_name,OBJ_LABEL,0,0,0))
  8.      {
  9.       Print("Error: can't create label! code #",GetLastError());
  10.       return(0);
  11.      }
  12. //--- set color to Red
  13.    ObjectSetInteger(current_chart_id,obj_name,OBJPROP_COLOR,clrRed);
  14. //--- move object down and change its text
  15.    for(i=0; i<200; i++)
  16.      {
  17.       //--- set text property
  18.       ObjectSetString(current_chart_id,obj_name,OBJPROP_TEXT,StringFormat("Simple Label at y= %d",i));
  19.       //--- set distance property
  20.       ObjectSet(obj_name,OBJPROP_YDISTANCE,i);
  21.       //--- forced chart redraw
  22.       ChartRedraw(current_chart_id);
  23.       Sleep(10);
  24.      }
  25. //--- set color to Blue
  26.    ObjectSetInteger(current_chart_id,obj_name,OBJPROP_COLOR,clrBlue);
  27. //--- move object up and change its text
  28.    for(i=200; i>0; i--)
  29.      {
  30.       //--- set text property
  31.       ObjectSetString(current_chart_id,obj_name,OBJPROP_TEXT,StringFormat("Simple Label at y= %d",i));
  32.       //--- set distance property
  33.       ObjectSet(obj_name,OBJPROP_YDISTANCE,i);
  34.       //--- forced chart redraw
  35.       ChartRedraw(current_chart_id);
  36.       Sleep(10);
  37.      }
  38. //--- delete object
  39.    ObjectDelete(obj_name);
  40.    return(0);
  41.   }
复制代码
举报

评论 使用道具

精彩评论4

jongjongyoshen
D
| 发表于 2021-12-26 08:51:05 | 显示全部楼层
谢谢分享
举报

点赞 评论 使用道具

EA1314
D
| 发表于 2021-12-26 20:44:09 | 显示全部楼层
谢谢分享
举报

点赞 评论 使用道具

交易者
DDD
| 发表于 2022-1-12 10:24:33 | 显示全部楼层
感谢分享
举报

点赞 评论 使用道具

nanaliu
CC
| 发表于 2022-5-9 08:39:55 | 显示全部楼层
看看。。感谢分享。。。。
举报

点赞 评论 使用道具

紫竹青荷
CC
| 发表于 2022-5-9 18:21:18 | 显示全部楼层
感谢分享
举报

点赞 评论 使用道具

发新帖
EA交易
您需要登录后才可以评论 登录 | 立即注册

天眼云VPS
简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)