//+------------------------------------------------------------------+
//| Market Spread.mq4 点差记录 ver1.0
http://www.oanda.net.cn |
//+------------------------------------------------------------------+
#property indicator_chart_window
extern int FontSize=12;
extern int WhichCorner0_3=2;
int Old_Point;
int MarketSpread;
int firsttime=1;
string FontType="黑体";
color FontColor = LawnGreen;
int fh;
int init()
{
fh = FileOpen("Spread.csv",FILE_CSV|FILE_WRITE,",");
if(fh>0) FileWrite(fh," 时间 "," Spread ",Symbol());
//FileClose(fh);
return(0);
}
int deinit()
{
ObjectDelete("Market_Point_Label");
FileClose(fh);
return(0);
}
int start()
{
MarketSpread=MarketInfo(Symbol(),MODE_SPREAD);
if(Old_Point!= MarketSpread) FileWrite(fh,TimeToStr(Time[0]),MarketSpread);
if (MarketSpread > Old_Point) FontColor = Red;
if (MarketSpread < Old_Point) FontColor = LawnGreen;
Old_Point = MarketSpread;
if(firsttime==1) FontColor = LawnGreen;
firsttime=0;
string Market_point = MarketSpread;
ObjectCreate("Market_Point_Label", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Market_Point_Label", Market_point, FontSize, FontType, FontColor);
ObjectSet("Market_Point_Label", OBJPROP_CORNER, WhichCorner0_3);
ObjectSet("Market_Point_Label", OBJPROP_XDISTANCE, 1);
ObjectSet("Market_Point_Label", OBJPROP_YDISTANCE, 1);
}
添加一帖 MT4 的点差记录器 源码。。。