下面源代码为“复盘历史K线对应的北京时间”,但是十字准线是红色的,想改成黑色的,但是找不到代码在哪里修改,望老师帮忙指导一下,谢谢!!!
//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2012, CompanyName |
//+------------------------------------------------------------------+
#property description "通过追踪鼠标定位图表中的北京时间"
#property description "用于复盘检视图表中时间轴对应的北京时间,回顾所发生的状况。"
#property description "用于复盘检视图表中时间轴对应财经日历时间所发生的状况。"
#property strict
extern color font_color = Yellow;//字体颜色
extern int font_size = 10;//字体大小
extern int corner = 0; //显示位置:0.左上角 1.右上角 2.左下角 3.右下角
extern int spread_distance_x = 25;//相对角落的X坐标
extern int spread_distance_y = 30;//相对角落的Y坐标
void OnInit()
{
//--- 启用 CHART_EVENT_MOUSE_MOVE 信息
ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,1);
}
//+------------------------------------------------------------------+
//|反初始化 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
// ObjectDelete("北京时间");
// ObjectDelete(0,"V Line");
Comment("");
}
//+------------------------------------------------------------------+
//| ChartEvent 函数 |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
const long &lparam,
const double &dparam,
const string &sparam)
{
//--- 如果这是鼠标点击事件图表
if(id==CHARTEVENT_MOUSE_MOVE)
{
//--- 准备变量
int x =(int)lparam;
int y =(int)dparam;
datetime dt =0;
double price =0;
int window=0;
//--- 依据日期/时间转换X和Y坐标
if(ChartXYToTimePrice(0,x,y,window,dt,price))
{
Comment("",TimeToString(dt-TimeGMTOffset()));
LabelCreate("北京时间",25,25,TimeToString(dt-TimeGMTOffset()));
if(ChartTimePriceToXY(0,window,dt,price,x,y))
{
Comment("",TimeToString(dt-TimeGMTOffset()));
LabelCreate("北京时间",25,25,TimeToString(dt-TimeGMTOffset()));
}
else
Print("return error code: ",GetLastError());
//--- 删除线
ObjectDelete(0,"V Line");
//--- 创建十字光标的水平线和垂直线
//ObjectCreate(0,"H Line",OBJ_HLINE,window,dt,price);
ObjectCreate(0,"V Line",OBJ_VLINE,window,dt,price);
ChartRedraw(0);
}
else
Print("return error code: ",GetLastError());
Print("+--------------------------------------------------------------+");
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void LabelCreate(string As_0,int A_x_8,int A_y_12,string A_text_16="-",string A_fontname_28="Arial",int A_window_40=0)
{
//如果还没显示,则显示
if(ObjectFind(As_0)==-1)
{
ObjectCreate(As_0,OBJ_LABEL,A_window_40,0,0);//标签型文字
ObjectSet(As_0,OBJPROP_CORNER,corner);//角落1、2、3、4
ObjectSet(As_0,OBJPROP_XDISTANCE,spread_distance_x);//横坐标
ObjectSet(As_0,OBJPROP_YDISTANCE,spread_distance_y);//纵坐标
}
ObjectSetText(As_0,A_text_16,font_size,A_fontname_28,font_color);
}
//+------------------------------------------------------------------+
|