|
|
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);
}
复制代码 |
|