void OnStart()
{
//---
string up_arrow="up_arrow";
datetime time=TimeCurrent();
double lastClose[1];
int close=CopyClose(Symbol(),Period(),0,1,lastClose); // 获得收盘价
//--- 如果获得价格
if(close>0)
{
ObjectCreate(0,up_arrow,OBJ_ARROW,0,0,0,0,0); // 创建一个箭头
ObjectSetInteger(0,up_arrow,OBJPROP_ARROWCODE,241); // 设置箭头代码
ObjectSetInteger(0,up_arrow,OBJPROP_TIME,time); // 设置时间
ObjectSetDouble(0,up_arrow,OBJPROP_PRICE,lastClose[0]);// 预定价格
ChartRedraw(0); // 现在绘制箭头
}
else
Print("Unable to get the latest Close price!");
}
|