创建标签脚本

| 发表于 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.   }
复制代码
最近访问 头像模式
举报

评论 使用道具

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

精品外汇EA