您需要 登录 才可以下载或查看,没有帐号?注册
#property copyright Copyright 2012, laoyee
#property link http://www.docin.com/yiwence
#property indicator_separate_window
//----程序预设参数
extern string str1 = ====系统预设参数====
extern int 本地时区=8;
int TimeZone;
extern int 倒计时=15;
int Countdown;
extern string str2 = ====交易所时间表====
extern string 纽约开市时间= 8:30
string NewYorkStartTime;
extern string 纽约收市时间= 15:00
string NewYorkCloseTime;
extern string 伦敦开市时间= 9:30
string LondonStartTime;
extern string 伦敦收市时间= 16:30
string LondonCloseTime;
extern string 法兰克福开市时间= 9:00
string FrankfurtStartTime;
extern string 法兰克福收市时间= 16:00
string FrankfurtCloseTime;
extern string 东京开市时间= 9:00
string TokyoStartTime;
extern string 东京收市时间= 15:30
string TokyoCloseTime;
extern string 悉尼开市时间= 9:00
string SydneyStartTime;
extern string 悉尼收市时间= 17:00
string SydneyCloseTime;
extern string 惠灵顿开市时间= 9:00
string WellingtonStartTime;
extern string 惠灵顿收市时间= 17:00
string WellingtonCloseTime;
extern string str3 = ====夏令时间表====
extern string 纽约开始时间= 2012.3.11 2:00:00
string NewYorkStartSummer;
extern string 纽约结束时间= 2012.11.4 2:00:00
string NewYorkCloseSummer;
extern string 伦敦开始时间= 2012.3.25 1:00:00
string LondonStartSummer;
extern string 伦敦结束时间= 2012.10.28 2:00:00
string LondonCloseSummer;
extern string 法兰克福开始时间= 2012.3.25 2:00:00
string FrankfurtStartSummer;
extern string 法兰克福结束时间= 2012.10.28 3:00:00
string FrankfurtCloseSummer;
extern string 悉尼开始时间= 2011.10.2 2:00:00
string SydneyStartSummer;
extern string 悉尼结束时间= 2012.4.1 3:00:00
string SydneyCloseSummer;
extern string 惠灵顿开始时间= 2011.9.25 2:00:00
string WellingtonStartSummer;
extern string 惠灵顿结束时间= 2012.4.1 3:00:00
string WellingtonCloseSummer;
int Corner=0; //交易信息显示四个角位置
datetime GMT;
color myColor=SlateGray;
int init()
{
TimeZone=本地时区;
Countdown=倒计时*60;
NewYorkStartTime=纽约开市时间;
NewYorkCloseTime=纽约收市时间;
LondonStartTime=伦敦开市时间;
LondonCloseTime=伦敦收市时间;
FrankfurtStartTime=法兰克福开市时间;
FrankfurtCloseTime=法兰克福收市时间;
TokyoStartTime=东京开市时间;
TokyoCloseTime=东京收市时间;
SydneyStartTime=悉尼开市时间;
SydneyCloseTime=悉尼收市时间;
WellingtonStartTime=惠灵顿开市时间;
WellingtonCloseTime=惠灵顿收市时间;
NewYorkStartSummer=纽约开始时间;
NewYorkCloseSummer=纽约结束时间;
LondonStartSummer=伦敦开始时间;
LondonCloseSummer=伦敦结束时间;
FrankfurtStartSummer=法兰克福开始时间;
FrankfurtCloseSummer=法兰克福结束时间;
SydneyStartSummer=悉尼开始时间;
SydneyCloseSummer=悉尼结束时间;
WellingtonStartSummer=惠灵顿开始时间;
WellingtonCloseSummer=惠灵顿结束时间;
return(0);
}
int deinit()
{
return(0);
}
int start()
{
iMain();
return(0);
}
void iMain()
{
//清除标签
int myWindowsHandle = WindowFind(WindowExpertName()); //获取当前指标名称所在窗口序号
ObjectsDeleteAll(myWindowsHandle, OBJ_LABEL);
GMT=TimeLocal()-TimeZone*3600;
// iDisplayInfo( GMT LocalTime1 , GMT +TimeToStr(GMT,TIME_SECONDS), Corner, 750, 5, 10, , SlateGray);
iDisplayInfo( GMT LocalTime2 , 服务器时间 +TimeToStr(TimeCurrent(),TIME_SECONDS), Corner, 750, 5, 10, , SlateGray);
iDisplayInfo( GMT LocalTime3 , 本地时间 +TimeToStr(TimeLocal(),TIME_SECONDS), Corner, 750, 25, 10, , SlateGray);
//惠灵顿+12
datetime myWellington=GMT+12*3600;
if (TimeDay(StrToTime(WellingtonStartTime)) TimeDay(myWellington)) //换算跨日
{
WellingtonStartTime=TimeToStr(StrToTime(WellingtonStartTime)+86400);
WellingtonCloseTime=TimeToStr(StrToTime(WellingtonCloseTime)+86400);
}
if (myWellington StrToTime(WellingtonStartSummer) myWellington StrToTime(WellingtonCloseSummer)) myWellington=myWellington+3600; //夏令时+1
myColor=SlateGray;
iDisplayInfo( WellingtonOpenCountdown , 休市 , Corner, 100, 25, 8, , myColor);
if ((StrToTime(WellingtonStartTime)-myWellington) Countdown (StrToTime(WellingtonStartTime)-myWellington) 0)
{
myColor=OrangeRed;
iDisplayInfo( WellingtonOpenCountdown , 距开市 +((StrToTime(WellingtonStartTime)-myWellington)/60+1)+ 分钟 , Corner, 90, 25, 8, , myColor);
}
if (myWellington StrToTime(WellingtonStartTime) myWellington StrToTime(WellingtonCloseTime))
{
myColor=ForestGreen;
iDisplayInfo( WellingtonOpenCountdown , 正在交易 , Corner, 100, 25, 8, , myColor);
}
if ((StrToTime(WellingtonCloseTime)-myWellington) Countdown (StrToTime(WellingtonCloseTime)-myWellington) 0)
{
myColor=Red;
iDisplayInfo( WellingtonOpenCountdown , 距收市 +((StrToTime(WellingtonCloseTime)-myWellington)/60+1)+ 分钟 , Corner, 90, 25, 8, , myColor);
}
iDisplayInfo( WellingtonTime , 惠灵顿 +TimeToStr(myWellington,TIME_SECONDS), Corner, 70, 5, 10, , myColor);
// iDisplayInfo( WellingtonDate , TimeToStr(myWellington,TIME_DATE), Corner, 90, 25, 10, , myColor);
//悉尼+10
datetime mySydney=GMT+10*3600;
if (TimeDay(StrToTime(SydneyStartTime)) TimeDay(mySydney)) //换算跨日
{
SydneyStartTime=TimeToStr(StrToTime(SydneyStartTime)+86400);
SydneyCloseTime=TimeToStr(StrToTime(SydneyCloseTime)+86400);
}
if (mySydney StrToTime(SydneyStartSummer) mySydney StrToTime(SydneyCloseSummer)) mySydney=mySydney+3600; //夏令时+1
myColor=SlateGray;
iDisplayInfo( SydneyOpenCountdown , 休市 , Corner, 200, 25, 8, , myColor);
if ((StrToTime(SydneyStartTime)-mySydney) Countdown (StrToTime(SydneyStartTime)-mySydney) 0)
{
myColor=OrangeRed;
iDisplayInfo( SydneyOpenCountdown , 距开市 +((StrToTime(SydneyStartTime)-mySydney)/60+1)+ 分钟 , Corner, 200, 25, 8, , myColor);
}
if (mySydney StrToTime(SydneyStartTime) mySydney StrToTime(SydneyCloseTime))
{
myColor=ForestGreen;
iDisplayInfo( SydneyOpenCountdown , 正在交易 , Corner, 200, 25, 8, , myColor);
}
if ((StrToTime(SydneyCloseTime)-mySydney) Countdown (StrToTime(SydneyCloseTime)-mySydney) 0)
{
myColor=Red;
iDisplayInfo( SydneyOpenCountdown , 距收市 +((StrToTime(SydneyCloseTime)-mySydney)/60+1)+ 分钟 , Corner, 200, 25, 8, , myColor);
}
iDisplayInfo( SydneyTime , 悉尼 +TimeToStr(mySydney,TIME_SECONDS), Corner, 190, 5, 10, , myColor);
// iDisplayInfo( SydneyDate , TimeToStr(mySydney,TIME_DATE), Corner, 200, 25, 10, , myColor);
//东京+9
datetime myTokyo=GMT+9*3600;
if (TimeDay(StrToTime(TokyoStartTime)) TimeDay(myTokyo)) //换算跨日
{
TokyoStartTime=TimeToStr(StrToTime(TokyoStartTime)+86400);
TokyoCloseTime=TimeToStr(StrToTime(TokyoCloseTime)+86400);
}
myColor=SlateGray;
iDisplayInfo( TokyoOpenCountdown , 休市 , Corner, 300, 25, 8, , myColor);
if ((StrToTime(TokyoStartTime)-myTokyo) Countdown (StrToTime(TokyoStartTime)-myTokyo) 0)
{
myColor=OrangeRed;
iDisplayInfo( TokyoOpenCountdown , 距开市 +((StrToTime(TokyoStartTime)-myTokyo)/60+1)+ 分钟 , Corner, 300, 25, 8, , myColor);
}
if (myTokyo StrToTime(TokyoStartTime) myTokyo StrToTime(TokyoCloseTime))
{
myColor=ForestGreen;
iDisplayInfo( TokyoOpenCountdown , 正在交易 , Corner, 300, 25, 8, , myColor);
}
if ((StrToTime(TokyoCloseTime)-myTokyo) Countdown (StrToTime(TokyoCloseTime)-myTokyo) 0)
{
myColor=Red;
iDisplayInfo( TokyoOpenCountdown , 距收市 +((StrToTime(TokyoCloseTime)-myTokyo)/60+1)+ 分钟 , Corner, 300, 25, 8, , myColor);
}
iDisplayInfo( TokyoTime , 东京 +TimeToStr(myTokyo,TIME_SECONDS), Corner, 290, 5, 10, , myColor);
// iDisplayInfo( TokyoDate , TimeToStr(myTokyo,TIME_DATE), Corner, 300, 25, 10, , myColor);
//法兰克福+1
datetime myFrankfurt=GMT+1*3600;
if (TimeDay(StrToTime(FrankfurtStartTime)) TimeDay(myFrankfurt)) //换算跨日
{
FrankfurtStartTime=TimeToStr(StrToTime(FrankfurtStartTime)+86400);
FrankfurtCloseTime=TimeToStr(StrToTime(FrankfurtCloseTime)+86400);
}
if (myFrankfurt StrToTime(FrankfurtStartSummer) myFrankfurt StrToTime(FrankfurtCloseSummer)) myFrankfurt=myFrankfurt+3600; //夏令时+1
myColor=SlateGray;
iDisplayInfo( FrankfurtOpenCountdown , 休市 , Corner, 420, 25, 8, , myColor);
if ((StrToTime(FrankfurtStartTime)-myFrankfurt) Countdown (StrToTime(FrankfurtStartTime)-myFrankfurt) 0)
{
myColor=OrangeRed;
iDisplayInfo( FrankfurtOpenCountdown , 距开市 +((StrToTime(FrankfurtStartTime)-myFrankfurt)/60+1)+ 分钟 , Corner, 420, 25, 8, , myColor);
}
if (myFrankfurt StrToTime(FrankfurtStartTime) myFrankfurt StrToTime(FrankfurtCloseTime))
{
myColor=ForestGreen;
iDisplayInfo( FrankfurtOpenCountdown , 正在交易 , Corner, 430, 25, 8, , myColor);
}
if ((StrToTime(FrankfurtCloseTime)-myFrankfurt) Countdown (StrToTime(FrankfurtCloseTime)-myFrankfurt) 0)
{
myColor=Red;
iDisplayInfo( FrankfurtOpenCountdown , 距收市 +((StrToTime(FrankfurtCloseTime)-myFrankfurt)/60+1)+ 分钟 , Corner, 420, 25, 8, , myColor);
}
iDisplayInfo( FrankfurtTime , 法兰克福 +TimeToStr(myFrankfurt,TIME_SECONDS), Corner, 390, 5, 10, , myColor);
// iDisplayInfo( FrankfurtDate , TimeToStr(myFrankfurt,TIME_DATE), Corner, 420, 25, 10, , myColor);
//伦敦GMT
datetime myLondon=GMT+0*3600;
if (TimeDay(StrToTime(LondonStartTime)) TimeDay(myLondon)) //换算跨日
{
LondonStartTime=TimeToStr(StrToTime(LondonStartTime)+86400);
LondonCloseTime=TimeToStr(StrToTime(LondonCloseTime)+86400);
}
if (myLondon StrToTime(LondonStartSummer) myLondon StrToTime(LondonCloseSummer)) myLondon=myLondon+3600; //夏令时+1
myColor=SlateGray;
iDisplayInfo( LondonOpenCountdown , 休市 , Corner, 550, 25, 8, , myColor);
if ((StrToTime(LondonStartTime)-myLondon) Countdown (StrToTime(LondonStartTime)-myLondon) 0)
{
myColor=OrangeRed;
iDisplayInfo( LondonOpenCountdown , 距开市 +((StrToTime(LondonStartTime)-myLondon)/60+1)+ 分钟 , Corner, 530, 25, 8, , myColor);
}
if (myLondon StrToTime(LondonStartTime) myLondon StrToTime(LondonCloseTime))
{
myColor=ForestGreen;
iDisplayInfo( LondonOpenCountdown , 正在交易 , Corner, 530, 25, 8, , myColor);
}
if ((StrToTime(LondonCloseTime)-myLondon) Countdown (StrToTime(LondonCloseTime)-myLondon) 0)
{
myColor=Red;
iDisplayInfo( LondonOpenCountdown , 距收市 +((StrToTime(LondonCloseTime)-myLondon)/60+1)+ 分钟 , Corner, 530, 25, 8, , myColor);
}
iDisplayInfo( LondonTime , 伦敦 +TimeToStr(myLondon,TIME_SECONDS), Corner, 520, 5, 10, , myColor);
// iDisplayInfo( LondonDate , TimeToStr(myLondon,TIME_DATE), Corner, 530, 25, 10, , myColor);
//纽约-5
datetime myNewYork=GMT+(-5)*3600;
if (TimeDay(StrToTime(NewYorkStartTime)) TimeDay(myNewYork)) //换算跨日
{
NewYorkStartTime=TimeToStr(StrToTime(NewYorkStartTime)+86400);
NewYorkCloseTime=TimeToStr(StrToTime(NewYorkCloseTime)+86400);
}
if (myNewYork StrToTime(NewYorkStartSummer) myNewYork StrToTime(NewYorkCloseSummer)) myNewYork=myNewYork+3600; //夏令时+1
myColor=SlateGray;
iDisplayInfo( NewYorkOpenCountdown , 休市 , Corner, 650, 25, 8, , myColor);
if ((StrToTime(NewYorkStartTime)-myNewYork) Countdown (StrToTime(NewYorkStartTime)-myNewYork) 0)
{
myColor=OrangeRed;
iDisplayInfo( NewYorkOpenCountdown , 距开市 +((StrToTime(NewYorkStartTime)-myNewYork)/60+1)+ 分钟 , Corner, 625, 25, 8, , myColor);
}
if (myNewYork StrToTime(NewYorkStartTime) myNewYork StrToTime(NewYorkCloseTime))
{
myColor=ForestGreen;
iDisplayInfo( NewYorkOpenCountdown , 正在交易 , Corner, 640, 25, 8, , myColor);
}
if ((StrToTime(NewYorkCloseTime)-myNewYork) Countdown (StrToTime(NewYorkCloseTime)-myNewYork) 0)
{
myColor=Red;
iDisplayInfo( NewYorkOpenCountdown , 距收市 +((StrToTime(NewYorkCloseTime)-myNewYork)/60+1)+ 分钟 , Corner, 625, 25, 8, , myColor);
}
iDisplayInfo( NewYorkTime , 纽约 +TimeToStr(myNewYork,TIME_SECONDS), Corner, 620, 5, 10, , myColor);
// iDisplayInfo( NewYorkDate , TimeToStr(myNewYork,TIME_DATE), Corner, 630, 25, 10, , myColor);
return(0);
}
void iDisplayInfo(string LableName,string LableDoc,int Corner,int LableX,int LableY,int DocSize,string DocStyle,color DocColor)
{
int myWindowsHandle = WindowFind(WindowExpertName());
ObjectCreate(LableName, OBJ_LABEL, myWindowsHandle, 0, 0);
ObjectSetText(LableName, LableDoc, DocSize, DocStyle,DocColor);
ObjectSet(LableName, OBJPROP_CORNER, Corner);
ObjectSet(LableName, OBJPROP_XDISTANCE, LableX);
ObjectSet(LableName, OBJPROP_YDISTANCE, LableY);
return(0);
}
本主题由 admin 于 2018-12-11 16:48 移动
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!