在上图中,蓝色水平线对象是最旧的对象,如何获取?
类似:
if (blue < yellow) && (blue < pink) && (blue < red)) { printf ("blue is the oldest object"); }
我需要使用ibarshift吗?我可以举代码示例吗?
答案 0 :(得分:1)
string oldestObjectName="", name;
datetime oldestObjectDate=INT_MAX, tmpDate;
for(int i=ObjectsTotal()-1;i>=0;i--)
{
name=ObjectName(i);
tmpDate=ObjectGetInteger(0,name,OBJPROP_TIME1);
if(tmpDate<oldestObjectDate)
{
oldestObjectDate=tmpDate;
oldestObjectName=name;
}
}
printf("oldest object is %s, its time1=%s",oldestObjectName,TimeToString(oldestObjectDate));