找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 28|回复: 0

创建标签脚本

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-27 12:56:00 | 显示全部楼层 |阅读模式
int start()
  {
   int i;
   string obj_name="label_object";
   long current_chart_id=ChartID();
//--- creating label object (it does not have time/price coordinates)
   if(!ObjectCreate(current_chart_id,obj_name,OBJ_LABEL,0,0,0))
     {
      Print("Error: can't create label! code #",GetLastError());
      return(0);
     }
//--- set color to Red
   ObjectSetInteger(current_chart_id,obj_name,OBJPROP_COLOR,clrRed);
//--- move object down and change its text
   for(i=0; i<200; i++)
     {
      //--- set text property
      ObjectSetString(current_chart_id,obj_name,OBJPROP_TEXT,StringFormat("Simple Label at y= %d",i));
      //--- set distance property
      ObjectSet(obj_name,OBJPROP_YDISTANCE,i);
      //--- forced chart redraw
      ChartRedraw(current_chart_id);
      Sleep(10);
     }
//--- set color to Blue
   ObjectSetInteger(current_chart_id,obj_name,OBJPROP_COLOR,clrBlue);
//--- move object up and change its text
   for(i=200; i>0; i--)
     {
      //--- set text property
      ObjectSetString(current_chart_id,obj_name,OBJPROP_TEXT,StringFormat("Simple Label at y= %d",i));
      //--- set distance property
      ObjectSet(obj_name,OBJPROP_YDISTANCE,i);
      //--- forced chart redraw
      ChartRedraw(current_chart_id);
      Sleep(10);
     }
//--- delete object
   ObjectDelete(obj_name);
   return(0);
  }
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-10 05:18 , Processed in 0.089065 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表