//+------------------------------------------------------------------+
//| NewsImpactEUR.mq4 |
//| Copyright 2013, newsimpactstrategy |
//| http://newsimpactstrategy.blogspot.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, newsimpactstrategy"
#property link "http://newsimpactstrategy.blogspot.com/"
#include <WinUser32.mqh>
#include <stdlib.mqh>
//--- input parameters
extern int GMTOffset=2;
extern string FileName = "NewsFile.csv";
int TimeCurr;
int TimeGMT,TimeTokyo,TimeNewYork,TimeSydney;
int spread,NearCloseL,NearCloseR;
double Dpoint;
double Lots,Newsupdate;
double dateft[5];
string ftext[5];
int NeartimeL=0,NeartimeLA=0,NeartimeRA;
int NeartimeR=0;
string NearStrL,NearStrR;
int arraydate,arraycount;
int x,y;
int eventCount;
int eventTimes[100];
string eventCurr[100],eventImp[100], eventNames[100],
eventPrev[100],eventFcs[100];
string eventHysDate1[100];
string eventEURUSD1N_1[100], eventEURUSD5N_1[100],
eventEURUSD15N_1[100],eventEURUSD30N_1[100],eventEURUSD60N_1[100],
eventEURUSD1P_1[100], eventEURUSD5P_1[100],
eventEURUSD15P_1[100], eventEURUSD30P_1[100],eventEURUSD60P_1[100];
string eventGBPUSD1N_1[100], eventGBPUSD5N_1[100], eventGBPUSD15N_1[100],
eventGBPUSD30N_1[100], eventGBPUSD60N_1[100],
eventGBPUSD1P_1[100], eventGBPUSD5P_1[100], eventGBPUSD15P_1[100],
eventGBPUSD30P_1[100], eventGBPUSD60P_1[100];
string eventHysDate2[100];
string eventEURUSD1N_2[100], eventEURUSD5N_2[100], eventEURUSD15N_2[100],
eventEURUSD30N_2[100], eventEURUSD60N_2[100],
eventEURUSD1P_2[100], eventEURUSD5P_2[100], eventEURUSD15P_2[100],
eventEURUSD30P_2[100], eventEURUSD60P_2[100];
string eventGBPUSD1N_2[100], eventGBPUSD5N_2[100], eventGBPUSD15N_2[100],
eventGBPUSD30N_2[100], eventGBPUSD60N_2[100],
eventGBPUSD1P_2[100], eventGBPUSD5P_2[100], eventGBPUSD15P_2[100],
eventGBPUSD30P_2[100], eventGBPUSD60P_2[100];
string eventHysDate3[100];
string eventEURUSD1N_3[100], eventEURUSD5N_3[100],eventEURUSD15N_3[100],
eventEURUSD30N_3[100], eventEURUSD60N_3[100],
eventEURUSD1P_3[100], eventEURUSD5P_3[100],eventEURUSD15P_3[100],
eventEURUSD30P_3[100], eventEURUSD60P_3[100];
string eventGBPUSD1N_3[100], eventGBPUSD5N_3[100], eventGBPUSD15N_3[100],
eventGBPUSD30N_3[100], eventGBPUSD60N_3[100],
eventGBPUSD1P_3[100], eventGBPUSD5P_3[100], eventGBPUSD15P_3[100],
eventGBPUSD30P_3[100], eventGBPUSD60P_3[100];
int ii = 0;
color TokyoColor = Orange, LondonColor = LightSalmon, NYColor=SandyBrown, SydneyColor = DarkOrange;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//TimeCurr=StrToTime("2013.02.16 16:08");
TimeCurr=TimeCurrent();
TimeGMT = TimeCurr-3600*GMTOffset;
Box();
DiplayClock();
FileLoad();
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
ObjectsDeleteAll();
//----
return(0);
}
//read file
int FileLoad()
{
int FileHandle = FileOpen("NewsFile.csv", FILE_CSV|FILE_READ,',');
if(FileHandle==0)
Print("File "+"NewsFile.csv"+" not found.");
int lim,lima,i=0, j=0, hyst[100], hysta[100];
for(eventCount = 0; !FileIsEnding(FileHandle); eventCount++)
{
eventTimes[eventCount] = StrToTime(FileReadString(FileHandle)); //1
eventCurr[eventCount] = FileReadString(FileHandle); //2
eventImp[eventCount]=FileReadString(FileHandle); //3
eventNames[eventCount] = FileReadString(FileHandle); //4
eventPrev[eventCount] = FileReadString(FileHandle); //5
eventFcs[eventCount] = FileReadString(FileHandle); //6
eventHysDate1[eventCount] = FileReadString(FileHandle);//7
eventEURUSD1N_1[eventCount] = FileReadString(FileHandle);//9
eventEURUSD1P_1[eventCount] = FileReadString(FileHandle);//8
eventEURUSD5N_1[eventCount] = FileReadString(FileHandle);//10
eventEURUSD5P_1[eventCount] = FileReadString(FileHandle);//11
eventEURUSD15N_1[eventCount] = FileReadString(FileHandle);//13
eventEURUSD15P_1[eventCount] = FileReadString(FileHandle);//12
eventEURUSD30N_1[eventCount] = FileReadString(FileHandle);//15
eventEURUSD30P_1[eventCount] = FileReadString(FileHandle);//14
eventEURUSD60N_1[eventCount] = FileReadString(FileHandle);//17
eventEURUSD60P_1[eventCount] = FileReadString(FileHandle);//16
eventHysDate2[eventCount] = FileReadString(FileHandle);//28
eventEURUSD1N_2[eventCount] = FileReadString(FileHandle);//30
eventEURUSD1P_2[eventCount] = FileReadString(FileHandle);//29
eventEURUSD5N_2[eventCount] = FileReadString(FileHandle);//32
eventEURUSD5P_2[eventCount] = FileReadString(FileHandle);//31
eventEURUSD15N_2[eventCount] = FileReadString(FileHandle);//34
eventEURUSD15P_2[eventCount] = FileReadString(FileHandle);//33
eventEURUSD30N_2[eventCount] = FileReadString(FileHandle);//36
eventEURUSD30P_2[eventCount] = FileReadString(FileHandle);//35
eventEURUSD60N_2[eventCount] = FileReadString(FileHandle);//38
eventEURUSD60P_2[eventCount] = FileReadString(FileHandle);//37
eventHysDate3[eventCount] = FileReadString(FileHandle);//49
eventEURUSD1N_3[eventCount] = FileReadString(FileHandle);//51
eventEURUSD1P_3[eventCount] = FileReadString(FileHandle);//50
eventEURUSD5N_3[eventCount] = FileReadString(FileHandle);//53
eventEURUSD5P_3[eventCount] = FileReadString(FileHandle);//52
eventEURUSD15N_3[eventCount] = FileReadString(FileHandle);//55
eventEURUSD15P_3[eventCount] = FileReadString(FileHandle);//54
eventEURUSD30N_3[eventCount] = FileReadString(FileHandle);//57
eventEURUSD30P_3[eventCount] = FileReadString(FileHandle);//56
eventEURUSD60N_3[eventCount] = FileReadString(FileHandle);//59
eventEURUSD60P_3[eventCount] = FileReadString(FileHandle);//58
if(eventTimes[eventCount]<TimeGMT)
{
lim=eventCount;
i=i+1;hyst[i]=eventCount;
}
if(eventTimes[eventCount]>=TimeGMT)
{
lima=eventCount;
j=j+1;hysta[j]=eventCount;
}
}//for
DisplayNews(hyst[i-1],0,1);
DisplayNews(hyst[i],2,2);
DisplayNews(hysta[1],4,3);
DisplayNews(hysta[2],6,4);
DisplayNews(hysta[3],8,5);
DisplayNews(hysta[4],10,6);
DisplayNews(hysta[5],12,8);
arraydate=eventCount;
arraycount=eventCount;
FileClose(FileHandle);
return(1);
}
int DisplayNews(int i,int ii,int code)
{
string LblNews;
string LblDateNews,LblCurNews,LblIpNews,LblFcsNews,LblPreNews;
string LbleventHysDate1, LbleventEURUSD1N_1, LbleventEURUSD5N_1,
LbleventEURUSD15N_1,LbleventEURUSD30N_1,LbleventEURUSD60N_1,
LbleventEURUSD1P_1, LbleventEURUSD5P_1,
LbleventEURUSD15P_1,LbleventEURUSD30P_1,LbleventEURUSD60P_1;
string LblarrowEURUSD1_1, LblarrowEURUSD5_1, LblarrowEURUSD15_1, LblarrowEURUSD30_1, LblarrowEURUSD60_1;
string LbleventGBPUSD1N_1, LbleventGBPUSD5N_1, LbleventGBPUSD15N_1,
LbleventGBPUSD30N_1, LbleventGBPUSD60N_1,
LbleventGBPUSD1P_1, LbleventGBPUSD5P_1, LbleventGBPUSD15P_1,
LbleventGBPUSD30P_1, LbleventGBPUSD60P_1;
string LblarrowGBPUSD1_1, LblarrowGBPUSD5_1, LblarrowGBPUSD15_1, LblarrowGBPUSD30_1, LblarrowGBPUSD60_1;
string LbleventHysDate2;
string LbleventEURUSD1N_2, LbleventEURUSD5N_2, LbleventEURUSD15N_2,
LbleventEURUSD30N_2, LbleventEURUSD60N_2,
LbleventEURUSD1P_2, LbleventEURUSD5P_2, LbleventEURUSD15P_2,
LbleventEURUSD30P_2, LbleventEURUSD60P_2;
string LblarrowEURUSD1_2, LblarrowEURUSD5_2, LblarrowEURUSD15_2, LblarrowEURUSD30_2, LblarrowEURUSD60_2;
string LbleventGBPUSD1N_2, LbleventGBPUSD5N_2, LbleventGBPUSD15N_2,
LbleventGBPUSD30N_2, LbleventGBPUSD60N_2,
LbleventGBPUSD1P_2, LbleventGBPUSD5P_2, LbleventGBPUSD15P_2,
LbleventGBPUSD30P_2, LbleventGBPUSD60P_2;
string LblarrowGBPUSD1_2, LblarrowGBPUSD5_2, LblarrowGBPUSD15_2, LblarrowGBPUSD30_2, LblarrowGBPUSD60_2;
string LbleventHysDate3;
string LbleventEURUSD1N_3, LbleventEURUSD5N_3,LbleventEURUSD15N_3,
LbleventEURUSD30N_3, LbleventEURUSD60N_3,
LbleventEURUSD1P_3, LbleventEURUSD5P_3,LbleventEURUSD15P_3,
LbleventEURUSD30P_3, LbleventEURUSD60P_3;
string LblarrowEURUSD1_3, LblarrowEURUSD5_3, LblarrowEURUSD15_3, LblarrowEURUSD30_3, LblarrowEURUSD60_3;
string LbleventGBPUSD1N_3, LbleventGBPUSD5N_3, LbleventGBPUSD15N_3,
LbleventGBPUSD30N_3, LbleventGBPUSD60N_3,
LbleventGBPUSD1P_3, LbleventGBPUSD5P_3, LbleventGBPUSD15P_3,
LbleventGBPUSD30P_3, LbleventGBPUSD60P_3;
string LblarrowGBPUSD1_3, LblarrowGBPUSD5_3, LblarrowGBPUSD15_3, LblarrowGBPUSD30_3, LblarrowGBPUSD60_3;
string TCodeStr;
color impcolor;
LblNews=StringConcatenate("DNews",code);
LblCurNews=StringConcatenate("CurNews",code);
LblIpNews=StringConcatenate("IpNews",code);
LblDateNews=StringConcatenate("LblDatenews",code);
LblPreNews=StringConcatenate("PreNews",code);
LblFcsNews=StringConcatenate("FcsNews",code);
LbleventHysDate1 = StringConcatenate("LbleventHysDate1",code);
LbleventEURUSD1N_1= StringConcatenate("LbleventEURUSD1N_1",code);
LbleventEURUSD5N_1= StringConcatenate("LbleventEURUSD5N_1",code);
LbleventEURUSD15N_1= StringConcatenate("LbleventEURUSD15N_1",code);
LbleventEURUSD30N_1= StringConcatenate("LbleventEURUSD30N_1",code);
LbleventEURUSD60N_1= StringConcatenate("LbleventEURUSD60N_1",code);
LblarrowEURUSD1_1= StringConcatenate("LblarrowEURUSD1_1",code);
LblarrowEURUSD5_1= StringConcatenate("LblarrowEURUSD5_1",code);
LblarrowEURUSD15_1= StringConcatenate("LblarrowEURUSD15_1",code);
LblarrowEURUSD30_1= StringConcatenate("LblarrowEURUSD30_1",code);
LblarrowEURUSD60_1= StringConcatenate("LblarrowEURUSD60_1",code);
LbleventEURUSD1P_1= StringConcatenate("LbleventEURUSD1P_1",code);
LbleventEURUSD5P_1= StringConcatenate("LbleventEURUSD5P_1",code);
LbleventEURUSD15P_1= StringConcatenate("LbleventEURUSD15P_1",code);
LbleventEURUSD30P_1= StringConcatenate("LbleventEURUSD30P_1",code);
LbleventEURUSD60P_1= StringConcatenate("LbleventEURUSD60P_1",code);
LbleventHysDate2= StringConcatenate("LbleventHysDate2",code);
LbleventEURUSD1N_2= StringConcatenate("LbleventEURUSD1N_2",code);
LbleventEURUSD5N_2= StringConcatenate("LbleventEURUSD5N_2",code);
LbleventEURUSD15N_2= StringConcatenate("LbleventEURUSD15N_2",code);
LbleventEURUSD30N_2= StringConcatenate("LbleventEURUSD30N_2",code);
LbleventEURUSD60N_2= StringConcatenate("LbleventEURUSD60N_2",code);
LbleventEURUSD1P_2= StringConcatenate("LbleventEURUSD1P_2",code);
LbleventEURUSD5P_2= StringConcatenate("LbleventEURUSD5P_2",code);
LbleventEURUSD15P_2= StringConcatenate("LbleventEURUSD15P_2",code);
LbleventEURUSD30P_2= StringConcatenate("LbleventEURUSD30P_2",code);
LbleventEURUSD60P_2= StringConcatenate("LbleventEURUSD60P_2",code);
LblarrowEURUSD1_2= StringConcatenate("LblarrowEURUSD1_2",code);
LblarrowEURUSD5_2= StringConcatenate("LblarrowEURUSD5_2",code);
LblarrowEURUSD15_2= StringConcatenate("LblarrowEURUSD15_2",code);
LblarrowEURUSD30_2= StringConcatenate("LblarrowEURUSD30_2",code);
LblarrowEURUSD60_2= StringConcatenate("LblarrowEURUSD60_2",code);
LbleventHysDate3= StringConcatenate("LbleventHysDate3",code);
LbleventEURUSD1N_3= StringConcatenate("LbleventEURUSD1N_3",code);
LbleventEURUSD5N_3= StringConcatenate("LbleventEURUSD5N_3",code);
LbleventEURUSD15N_3= StringConcatenate("LbleventEURUSD15N_3",code);
LbleventEURUSD30N_3= StringConcatenate("LbleventEURUSD30N_3",code);
LbleventEURUSD60N_3= StringConcatenate("LbleventEURUSD60N_3",code);
LbleventEURUSD1P_3= StringConcatenate("LbleventEURUSD1P_3",code);
LbleventEURUSD5P_3= StringConcatenate("LbleventEURUSD5P_3",code);
LbleventEURUSD15P_3= StringConcatenate("LbleventEURUSD15P_3",code);
LbleventEURUSD30P_3= StringConcatenate("LbleventEURUSD30P_3",code);
LbleventEURUSD60P_3= StringConcatenate("LbleventEURUSD60P_3",code);
LblarrowEURUSD1_3= StringConcatenate("LblarrowEURUSD1_3",code);
LblarrowEURUSD5_3= StringConcatenate("LblarrowEURUSD5_3",code);
LblarrowEURUSD15_3= StringConcatenate("LblarrowEURUSD15_3",code);
LblarrowEURUSD30_3= StringConcatenate("LblarrowEURUSD30_3",code);
LblarrowEURUSD60_3= StringConcatenate("LblarrowEURUSD60_3",code);
TCodeStr=StringConcatenate("",code);
if(eventImp[i]=="Hi") impcolor=Red;
if(eventImp[i]=="Med") impcolor=Yellow;
if(eventImp[i]=="Lo") impcolor=LimeGreen;
TextLabel(LblDateNews, TimeToStr(eventTimes[i]),732,ii*30+172,Honeydew);//815
TextLabel(LblCurNews, StringConcatenate(eventCurr[i]," "),687,ii*30+172,impcolor);//770
arrownews(LblIpNews,eventImp[i], 652, ii*30+172);
TextLabel(LblNews, StringConcatenate(eventNames[i]," "),652,ii*30+185,impcolor);
TextLabel(LblPreNews, StringConcatenate("P : ",eventPrev[i]),717,ii*30+200,impcolor);//800
TextLabel(LblFcsNews, StringConcatenate("F : ",eventFcs[i]),787,ii*30+200,impcolor);//735
if(code==1 || code ==2)
{
TextLabel(TCodeStr, TimeToStr(TimeGMT-eventTimes[i],TIME_MINUTES),652,ii*30+200, Blue);
}
if(code>=3)
{
TextLabel(TCodeStr, TimeToStr(eventTimes[i]-TimeGMT,TIME_MINUTES),652,ii*30+200, Honeydew);
}
//last
int Spc1 = 40;
int Str1 =460;
TextLabel(LbleventHysDate1, eventHysDate1[i], 520 ,ii*30+170,LightSalmon);
TextLabel(LbleventEURUSD1P_1, eventEURUSD1P_1[i],Str1,ii*30+185,Green);
TextLabel(LbleventEURUSD5P_1, eventEURUSD5P_1[i],Str1+Spc1,ii*30+185,Green);
TextLabel(LbleventEURUSD15P_1, eventEURUSD15P_1[i],Str1+2*Spc1,ii*30+185,Green);
TextLabel(LbleventEURUSD30P_1, eventEURUSD30P_1[i],Str1+3*Spc1,ii*30+185,Green);
TextLabel(LbleventEURUSD60P_1, eventEURUSD60P_1[i],Str1+4*Spc1,ii*30+185,Green);
TextLabel(LbleventEURUSD1N_1, eventEURUSD1N_1[i],Str1,ii*30+200,Red);
TextLabel(LbleventEURUSD5N_1, eventEURUSD5N_1[i],Str1+Spc1,ii*30+200,Red);
TextLabel(LbleventEURUSD15N_1, eventEURUSD15N_1[i],Str1+2*Spc1,ii*30+200,Red);
TextLabel(LbleventEURUSD30N_1, eventEURUSD30N_1[i],Str1+3*Spc1,ii*30+200,Red);
TextLabel(LbleventEURUSD60N_1, eventEURUSD60N_1[i],Str1+4*Spc1,ii*30+200,Red);
int str11=Str1-15;
if(StrToInteger(eventEURUSD1P_1[i]) - 0 > 0 - StrToInteger(eventEURUSD1N_1[i])) arrownews(LblarrowEURUSD1_1,"1", str11, ii*30+192);
if(StrToInteger(eventEURUSD1P_1[i]) - 0 < 0 - StrToInteger(eventEURUSD1N_1[i])) arrownews(LblarrowEURUSD1_1,"-1", str11, ii*30+192);
if(StrToInteger(eventEURUSD1P_1[i]) - 0 == 0 - StrToInteger(eventEURUSD1N_1[i])) arrownews(LblarrowEURUSD1_1,"0", str11, ii*30+192);
if(StrToInteger(eventEURUSD5P_1[i]) - 0 > 0 - StrToInteger(eventEURUSD5N_1[i])) arrownews(LblarrowEURUSD5_1,"1", str11 + Spc1, ii*30+192);
if(StrToInteger(eventEURUSD5P_1[i]) - 0 < 0 - StrToInteger(eventEURUSD5N_1[i])) arrownews(LblarrowEURUSD5_1,"-1", str11 + Spc1, ii*30+192);
if(StrToInteger(eventEURUSD5P_1[i]) - 0 == 0 - StrToInteger(eventEURUSD5N_1[i])) arrownews(LblarrowEURUSD5_1,"0", str11 + Spc1, ii*30+192);
if(StrToInteger(eventEURUSD15P_1[i]) - 0 > 0 - StrToInteger(eventEURUSD15N_1[i])) arrownews(LblarrowEURUSD15_1,"1", str11 + 2*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD15P_1[i]) - 0 < 0 - StrToInteger(eventEURUSD15N_1[i])) arrownews(LblarrowEURUSD15_1,"-1", str11 + 2*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD15P_1[i]) - 0 == 0 - StrToInteger(eventEURUSD15N_1[i])) arrownews(LblarrowEURUSD15_1,"0", str11 + 2*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD30P_1[i]) - 0 > 0 - StrToInteger(eventEURUSD30N_1[i])) arrownews(LblarrowEURUSD30_1,"1", str11 + 3*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD30P_1[i]) - 0 < 0 - StrToInteger(eventEURUSD30N_1[i])) arrownews(LblarrowEURUSD30_1,"-1", str11 + 3*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD30P_1[i]) - 0 == 0 - StrToInteger(eventEURUSD30N_1[i])) arrownews(LblarrowEURUSD30_1,"0", str11 + 3*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD60P_1[i]) - 0 > 0 - StrToInteger(eventEURUSD60N_1[i])) arrownews(LblarrowEURUSD60_1,"1", str11 + 4*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD60P_1[i]) - 0 < 0 - StrToInteger(eventEURUSD60N_1[i])) arrownews(LblarrowEURUSD60_1,"-1", str11 + 4*Spc1, ii*30+192);
if(StrToInteger(eventEURUSD60P_1[i]) - 0 == 0 - StrToInteger(eventEURUSD60N_1[i])) arrownews(LblarrowEURUSD60_1,"0", str11 + 4*Spc1, ii*30+192);
//2nd Last
TextLabel(LbleventHysDate2, eventHysDate2[i],300,ii*30+170,LightSalmon);
TextLabel(LbleventEURUSD1P_2, eventEURUSD1P_2[i],245,ii*30+185,Green);
TextLabel(LbleventEURUSD5P_2, eventEURUSD5P_2[i],285,ii*30+185,Green);
TextLabel(LbleventEURUSD15P_2, eventEURUSD15P_2[i],325,ii*30+185,Green);
TextLabel(LbleventEURUSD30P_2, eventEURUSD30P_2[i],365,ii*30+185,Green);
TextLabel(LbleventEURUSD60P_2, eventEURUSD60P_2[i],405,ii*30+185,Green);
TextLabel(LbleventEURUSD1N_2, eventEURUSD1N_2[i],245,ii*30+200,Red);
TextLabel(LbleventEURUSD5N_2, eventEURUSD5N_2[i],285,ii*30+200,Red);
TextLabel(LbleventEURUSD15N_2, eventEURUSD15N_2[i],325,ii*30+200,Red);
TextLabel(LbleventEURUSD30N_2, eventEURUSD30N_2[i],365,ii*30+200,Red);
TextLabel(LbleventEURUSD60N_2, eventEURUSD60N_2[i],405,ii*30+200,Red);
if(StrToInteger(eventEURUSD1P_2[i]) - 0 > 0 - StrToInteger(eventEURUSD1N_2[i])) arrownews(LblarrowEURUSD1_2,"1", 230, ii*30+192);
if(StrToInteger(eventEURUSD1P_2[i]) - 0 < 0 - StrToInteger(eventEURUSD1N_2[i])) arrownews(LblarrowEURUSD1_2,"-1", 230, ii*30+192);
if(StrToInteger(eventEURUSD1P_2[i]) - 0 == 0 - StrToInteger(eventEURUSD1N_2[i])) arrownews(LblarrowEURUSD1_2,"0", 230, ii*30+192);
if(StrToInteger(eventEURUSD5P_2[i]) - 0 > 0 - StrToInteger(eventEURUSD5N_2[i])) arrownews(LblarrowEURUSD5_2,"1", 270, ii*30+192);
if(StrToInteger(eventEURUSD5P_2[i]) - 0 < 0 - StrToInteger(eventEURUSD5N_2[i])) arrownews(LblarrowEURUSD5_2,"-1", 270, ii*30+192);
if(StrToInteger(eventEURUSD5P_2[i]) - 0 == 0 - StrToInteger(eventEURUSD5N_2[i])) arrownews(LblarrowEURUSD5_2,"0", 270, ii*30+192);
if(StrToInteger(eventEURUSD15P_2[i]) - 0 > 0 - StrToInteger(eventEURUSD15N_2[i])) arrownews(LblarrowEURUSD15_2,"1", 310, ii*30+192);
if(StrToInteger(eventEURUSD15P_2[i]) - 0 < 0 - StrToInteger(eventEURUSD15N_2[i])) arrownews(LblarrowEURUSD15_2,"-1", 310, ii*30+192);
if(StrToInteger(eventEURUSD15P_2[i]) - 0 == 0 - StrToInteger(eventEURUSD15N_2[i])) arrownews(LblarrowEURUSD15_2,"0", 310, ii*30+192);
if(StrToInteger(eventEURUSD30P_2[i]) - 0 > 0 - StrToInteger(eventEURUSD30N_2[i])) arrownews(LblarrowEURUSD30_2,"1", 350, ii*30+192);
if(StrToInteger(eventEURUSD30P_2[i]) - 0 < 0 - StrToInteger(eventEURUSD30N_2[i])) arrownews(LblarrowEURUSD30_2,"-1", 350, ii*30+192);
if(StrToInteger(eventEURUSD30P_2[i]) - 0 == 0 - StrToInteger(eventEURUSD30N_2[i])) arrownews(LblarrowEURUSD30_2,"0", 350, ii*30+192);
if(StrToInteger(eventEURUSD60P_2[i]) - 0 > 0 - StrToInteger(eventEURUSD60N_2[i])) arrownews(LblarrowEURUSD60_2,"1", 390, ii*30+192);
if(StrToInteger(eventEURUSD60P_2[i]) - 0 < 0 - StrToInteger(eventEURUSD60N_2[i])) arrownews(LblarrowEURUSD60_2,"-1", 390, ii*30+192);
if(StrToInteger(eventEURUSD60P_2[i]) - 0 == 0 - StrToInteger(eventEURUSD60N_2[i])) arrownews(LblarrowEURUSD60_2,"0", 390, ii*30+192);
//3rd Last
TextLabel(LbleventHysDate3, eventHysDate3[i],85,ii*30+170,LightSalmon);
TextLabel(LbleventEURUSD1P_3, eventEURUSD1P_3[i],30,ii*30+185,Green);
TextLabel(LbleventEURUSD5P_3, eventEURUSD5P_3[i],70,ii*30+185,Green);
TextLabel(LbleventEURUSD15P_3, eventEURUSD15P_3[i],110,ii*30+185,Green);
TextLabel(LbleventEURUSD30P_3, eventEURUSD30P_3[i],150,ii*30+185,Green);
TextLabel(LbleventEURUSD60P_3, eventEURUSD60P_3[i],190,ii*30+185,Green);
TextLabel(LbleventEURUSD1N_3, eventEURUSD1N_3[i],30,ii*30+200,Red);
TextLabel(LbleventEURUSD5N_3, eventEURUSD5N_3[i],70,ii*30+200,Red);
TextLabel(LbleventEURUSD15N_3, eventEURUSD15N_3[i],115,ii*30+200,Red);
TextLabel(LbleventEURUSD30N_3, eventEURUSD30N_3[i],150,ii*30+200,Red);
TextLabel(LbleventEURUSD60N_3, eventEURUSD60N_3[i],190,ii*30+200,Red);
if(StrToInteger(eventEURUSD1P_3[i]) - 0 > 0 - StrToInteger(eventEURUSD1N_3[i])) arrownews(LblarrowEURUSD1_3,"1", 15, ii*30+195);
if(StrToInteger(eventEURUSD1P_3[i]) - 0 < 0 - StrToInteger(eventEURUSD1N_3[i])) arrownews(LblarrowEURUSD1_3,"-1", 15, ii*30+195);
if(StrToInteger(eventEURUSD1P_3[i]) - 0 == 0 - StrToInteger(eventEURUSD1N_3[i])) arrownews(LblarrowEURUSD1_3,"0", 15, ii*30+195);
if(StrToInteger(eventEURUSD5P_3[i]) - 0 > 0 - StrToInteger(eventEURUSD5N_3[i])) arrownews(LblarrowEURUSD5_3,"1", 55, ii*30+195);
if(StrToInteger(eventEURUSD5P_3[i]) - 0 < 0 - StrToInteger(eventEURUSD5N_3[i])) arrownews(LblarrowEURUSD5_3,"-1", 55, ii*30+195);
if(StrToInteger(eventEURUSD5P_3[i]) - 0 == 0 - StrToInteger(eventEURUSD5N_3[i])) arrownews(LblarrowEURUSD5_3,"0", 55, ii*30+195);
if(StrToInteger(eventEURUSD15P_3[i]) - 0 > 0 - StrToInteger(eventEURUSD15N_3[i])) arrownews(LblarrowEURUSD15_3,"1", 95, ii*30+195);
if(StrToInteger(eventEURUSD15P_3[i]) - 0 < 0 - StrToInteger(eventEURUSD15N_3[i])) arrownews(LblarrowEURUSD15_3,"-1", 95, ii*30+195);
if(StrToInteger(eventEURUSD15P_3[i]) - 0 == 0 - StrToInteger(eventEURUSD15N_3[i])) arrownews(LblarrowEURUSD15_3,"0", 95, ii*30+195);
if(StrToInteger(eventEURUSD30P_3[i]) - 0 > 0 - StrToInteger(eventEURUSD30N_3[i])) arrownews(LblarrowEURUSD30_3,"1", 135, ii*30+195);
if(StrToInteger(eventEURUSD30P_3[i]) - 0 < 0 - StrToInteger(eventEURUSD30N_3[i])) arrownews(LblarrowEURUSD30_3,"-1", 135, ii*30+195);
if(StrToInteger(eventEURUSD30P_3[i]) - 0 == 0 - StrToInteger(eventEURUSD30N_3[i])) arrownews(LblarrowEURUSD30_3,"0", 135, ii*30+195);
if(StrToInteger(eventEURUSD60P_3[i]) - 0 > 0 - StrToInteger(eventEURUSD60N_3[i])) arrownews(LblarrowEURUSD60_3,"1", 175, ii*30+195);
if(StrToInteger(eventEURUSD60P_3[i]) - 0 < 0 - StrToInteger(eventEURUSD60N_3[i])) arrownews(LblarrowEURUSD60_3,"-1", 175, ii*30+195);
if(StrToInteger(eventEURUSD60P_3[i]) - 0 == 0 - StrToInteger(eventEURUSD60N_3[i])) arrownews(LblarrowEURUSD60_3,"0", 175, ii*30+195);
return(0);
}
void DiplayClock()
{
TimeNewYork=TimeGMT-5*3600;
TimeTokyo = TimeGMT + 9*3600;
TimeSydney = TimeGMT+11*3600;
ActiveSession();
TextLabels("TimeLocalt", TimeToStr(TimeLocal(),TIME_MINUTES) , 12, 55, 35, LimeGreen );
TextLabels("TimeLocald", TimeToStr(TimeLocal(),TIME_DATE) , 10, 40, 50, LimeGreen );
TextLabels("TimeLocals", "Local" , 10, 60, 70, LimeGreen );
TextLabels("TimeCurrt", TimeToStr(TimeCurr,TIME_MINUTES) , 12, 155, 35, Lime);
TextLabels("TimeCurrd", TimeToStr(TimeCurr,TIME_DATE) , 10, 140, 50, Lime);
TextLabels("TimeCurrs", "Server" , 10, 155, 70, Lime);
TextLabels("TimeGMTt", TimeToStr(TimeGMT,TIME_MINUTES) , 12, 255, 35, LondonColor);
TextLabels("TimeGMTd", TimeToStr(TimeGMT,TIME_DATE) , 10, 240, 50, LondonColor);
TextLabels("TimeGMTs", "London" , 10, 255, 70, LondonColor);
TextLabels("TimeNYt", TimeToStr(TimeNewYork,TIME_MINUTES) , 12, 355, 35, NYColor);
TextLabels("TimeNYd", TimeToStr(TimeNewYork,TIME_DATE) , 10, 340, 50, NYColor);
TextLabels("TimeNYs", "New York" , 10, 345, 70, NYColor);
TextLabels("TimeTokyot", TimeToStr(TimeTokyo,TIME_MINUTES) , 12, 455, 35, TokyoColor);
TextLabels("TimeTokyod", TimeToStr(TimeTokyo,TIME_DATE) , 10, 440, 50, TokyoColor);
TextLabels("TimeTokyos", "Tokyo" , 10, 460, 70, TokyoColor);
TextLabels("TimeSydneyt", TimeToStr(TimeSydney,TIME_MINUTES) , 12, 555, 35, SydneyColor);
TextLabels("TimeSydneyd", TimeToStr(TimeSydney,TIME_DATE) , 10, 540, 50, SydneyColor);
TextLabels("TimeSydneys", "Sydney" , 10, 554, 70, SydneyColor);
}
void ActiveSession()
{
if(TimeHour(TimeGMT)>6 && TimeHour(TimeGMT)<8) //Tokyo
{
BigBox("BoxTokyo", 430, 20 );
if(ObjectFind("BoxLondon")>-1) ObjectDelete("BoxLondon");
if(ObjectFind("BoxNY")>-1) ObjectDelete("BoxNY");
if(ObjectFind("BoxSydney")>-1) ObjectDelete("BoxSydney");
}
if(TimeHour(TimeGMT)==8) //London & Toky0
{
BigBox("BoxTokyo", 430, 20 ); BigBox("BoxLondon", 230, 20 );
if(ObjectFind("BoxNY")>-1) ObjectDelete("BoxNY");
if(ObjectFind("BoxSydney")>-1) ObjectDelete("BoxSydney");
}
if(TimeHour(TimeGMT)>8 && TimeHour(TimeGMT)<13) //London
{
BigBox("BoxLondon", 230, 20 );//London
if(ObjectFind("BoxTokyo")>-1) ObjectDelete("BoxTokyo");
if(ObjectFind("BoxNY")>-1) ObjectDelete("BoxNY");
if(ObjectFind("BoxSydney")>-1) ObjectDelete("BoxSydney");
}
if(TimeHour(TimeGMT)>=13 && TimeHour(TimeGMT)<=16) //NY and London
{
BigBox("BoxNY", 330, 20 ); BigBox("BoxLondon", 230, 20 );
if(ObjectFind("BoxTokyo")>-1) ObjectDelete("BoxTokyo");
if(ObjectFind("BoxSydney")>-1) ObjectDelete("BoxSydney");
}
if(TimeHour(TimeGMT)>13 && TimeHour(TimeGMT)<=21) //NY
{
BigBox("BoxNY", 330, 20 );//New York
if(ObjectFind("BoxTokyo")>-1) ObjectDelete("BoxTokyo");
if(ObjectFind("BoxLondon")>-1) ObjectDelete("BoxLondon");
if(ObjectFind("BoxSydney")>-1) ObjectDelete("BoxSydney");
}
if(TimeHour(TimeGMT)>=22 && TimeHour(TimeGMT)<=23) //Sydney
{
BigBox("BoxSydney", 530, 20 );//Sydney
if(ObjectFind("BoxTokyo")>-1) ObjectDelete("BoxTokyo");
if(ObjectFind("BoxLondon")>-1) ObjectDelete("BoxLondon");
if(ObjectFind("BoxNY")>-1) ObjectDelete("BoxNY");
}
if(TimeHour(TimeGMT)>=0 && TimeHour(TimeGMT)<=6)
{
BigBox("BoxSydney", 530, 20 );BigBox("BoxTokyo", 430, 20 );
if(ObjectFind("BoxLondon")>-1) ObjectDelete("BoxLondon");
if(ObjectFind("BoxNY")>-1) ObjectDelete("BoxNY");
}
//if(TimeHour(TimeGMT)>=0 && TimeHour(TimeGMT)<=8) BigBox("BoxTokyo", 430, 20 ); ObjectDelete(id); /tokyo
if(TimeHour(TimeGMT)>=8 && TimeHour(TimeGMT)<=16) BigBox("BoxLondon", 230, 20 );//London
if(TimeHour(TimeGMT)>=13 && TimeHour(TimeGMT)<=21)BigBox("BoxNY", 330, 20 );//New York
if(TimeHour(TimeGMT)>=22 && TimeHour(TimeGMT)<=6) BigBox("BoxSydney", 530, 20 );//Sydney
}
void AskBid()
{
TextLabels("bid", " Bid = " + DoubleToStr(Bid,Digits) , 10, 500, 97, Coral);
TextLabels("ask", " Ask = " + DoubleToStr(Ask,Digits) , 10, 250, 97, Coral);
TextLabels("Spread", "Spread = " + DoubleToStr((Ask-Bid)/Point,0) + " point" , 10, 40, 97, Coral);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
TimeCurr = TimeCurrent();
TimeGMT = TimeCurr-3600*GMTOffset;
FileLoad();
//DisplayNews();
DiplayClock();
AskBid();
ActiveSession();
//nearn();
//----
return(0);
}
//+------------------------------------------------------------------+
void Header()
{
TextLabel("Head1","Calender", 720, 140,LightSteelBlue );
TextLabel("Head4","Last", 535, 126,LightSteelBlue );
TextLabel("Head5","2nd Last", 308, 126,LightSteelBlue );
TextLabel("Head6","3rd Last", 97, 126,LightSteelBlue );
TextLabel("1M1","1M", 455, 150,LightSteelBlue );
TextLabel("5M1","5M", 495, 150,LightSteelBlue );
TextLabel("15M1","15M", 535, 150,LightSteelBlue );
TextLabel("30M1","30M", 575, 150,LightSteelBlue );
TextLabel("60M1","60M", 615, 150,LightSteelBlue );
TextLabel("1M2","1M", 245, 150,LightSteelBlue );
TextLabel("5M2","5M", 285, 150,LightSteelBlue );
TextLabel("15M2","15M", 320, 150,LightSteelBlue );
TextLabel("30M2","30M", 360, 150,LightSteelBlue );
TextLabel("60M2","60M", 400, 150,LightSteelBlue );
TextLabel("1M3","1M", 30, 150,LightSteelBlue );
TextLabel("5M3","5M", 70, 150,LightSteelBlue );
TextLabel("15M3","15M", 110, 150,LightSteelBlue );
TextLabel("30M3","30M", 150, 150,LightSteelBlue );
TextLabel("60M3","60M", 190, 150,LightSteelBlue );
}
void Box()
{
int i;
int y,yy;
Header();
// Right Vertical
y=25; yy=15;
for(i=0;i<=5;i++)
{
TextLabel1(StringConcatenate("LVBox",i),"|", 621, y+yy*i );
}
//Sub Box 1 for news history
for(i=0;i<=30;i++)
{
TextLabel1(StringConcatenate("SVBox1",i),"|", 220, 90+y+yy*i );
TextLabel1(StringConcatenate("SVBox2",i),"|", 435, 90+y+yy*i );
TextLabel1(StringConcatenate("SVBox3",i),"|", 645, 90+y+yy*i );
}
// Top Hoizontal
TextLabel1("THBox ","------------------------------------------------------------", 10, 20 );
TextLabel1("THBox1","---------------------------------------------------------------", 310, 20 );
TextLabel1("HSubBox ","------------------------------------------------------------", 10, 85 );
TextLabel1("HSub1Box.1","---------------------------------------------------------------", 310, 85 );
TextLabel("HSubBox2.0","------------------------------------------------------------", 10, 111,LightSteelBlue );
TextLabel("HSubBox2.1","------------------------------------------------------------", 310, 111,LightSteelBlue );
TextLabel("HSubBox2.2","-----------------------------------------", 610, 111,LightSteelBlue );
TextLabel("HSubBox3.0","------------------------------------------------------------", 10, 140,LightSteelBlue );
TextLabel("HSubBox3.1","------------------------------------------------------------", 310, 140,LightSteelBlue );
TextLabel("HSubBox3.2","----", 610, 140,LightSteelBlue );
TextLabel("HSubBox4.0","------------------------------------------------------------", 10, 160,LightSteelBlue );
TextLabel("HSubBox4.1","------------------------------------------------------------", 310, 160,LightSteelBlue );
TextLabel("HSubBox4.2","-----------------------------------------", 610, 160,LightSteelBlue );
int st=165-25;
color separator;
for(i=0;i<7;i++)
{
if(i==1) separator = Red;
if(i!=1) separator = LightSteelBlue;
TextLabel("HSubBox6.0"+StringConcatenate(i,""),"------------------------------------------------------------", 10, i*60+215,separator);
TextLabel("HSubBox6.1"+StringConcatenate(i,""),"------------------------------------------------------------", 310, i*60+215,separator);
TextLabel("HSubBox6.2"+StringConcatenate(i,""),"-----------------------------------------", 610, i*60+215,separator);
}
}
void TextLabel(string object, string Text, int X, int Y, color warna )
{
//---
ObjectCreate(object, OBJ_LABEL, 0, 0, 0);
ObjectSetText(object,Text,9, "Verdana", warna);
ObjectSet(object, OBJPROP_CORNER, 1);
ObjectSet(object, OBJPROP_XDISTANCE, X);
ObjectSet(object, OBJPROP_YDISTANCE, Y);
WindowRedraw();
return;
//----
}
void TextLabels(string object, string Text, int Size, int X, int Y, color warna )
{
//---
ObjectCreate(object, OBJ_LABEL, 0, 0, 0);
ObjectSetText(object,Text,Size, "Verdana", warna);
ObjectSet(object, OBJPROP_CORNER, 1);
ObjectSet(object, OBJPROP_XDISTANCE, X);
ObjectSet(object, OBJPROP_YDISTANCE, Y);
WindowRedraw();
return;
//----
}
void TextLabel1(string object, string Text, int X, int Y )
{
//---
//string textstring = Text;
ObjectCreate(object, OBJ_LABEL, 0, 0, 0);
ObjectSetText(object,Text,9, "Verdana", Aqua);
ObjectSet(object, OBJPROP_CORNER, 1);
ObjectSet(object, OBJPROP_XDISTANCE, X);
ObjectSet(object, OBJPROP_YDISTANCE, Y);
WindowRedraw();
//----
}
void BigBox(string object, int X, int Y )
{
//---
//string textstring = Text;
ObjectCreate(object, OBJ_LABEL, 0, 0, 0);
ObjectSetText(object,"5",65, "Wingdings 2", Chartreuse);
ObjectSet(object, OBJPROP_CORNER, 1);
ObjectSet(object, OBJPROP_XDISTANCE, X);
ObjectSet(object, OBJPROP_YDISTANCE, Y);
WindowRedraw();
//----
}
void ArrowT(string object, string Text, int X, int Y, color warna )
{
//---
//string textstring = Text;
ObjectCreate(object, OBJ_LABEL, 0, 0, 0);
ObjectSetText(object,Text,9, "Wingdings", warna);
ObjectSet(object, OBJPROP_CORNER, 1);
ObjectSet(object, OBJPROP_XDISTANCE, X);
ObjectSet(object, OBJPROP_YDISTANCE, Y);
WindowRedraw();
//----
}
void arrownews(string label,string inp, int X, int Y)
{
if (inp=="0") ArrowT(label, CharToStr(232), X, Y, Yellow );
if (inp=="1") ArrowT(label, CharToStr(233), X, Y, LimeGreen );
if (inp=="-1") ArrowT(label, CharToStr(234), X, Y, Red );
if (inp=="Hi") ArrowT(label, CharToStr(221), X, Y, Red );
if (inp=="Med") ArrowT(label, CharToStr(220), X, Y, Yellow );
if (inp=="Lo") ArrowT(label, CharToStr(222), X, Y, LimeGreen );
if (inp!="-1" && inp !="1" && inp!="0" && inp!="Hi" &&inp!="Med" && inp!="Lo" ) ArrowT(label, CharToStr(179), X, Y, Gold );
return;
}
No comments:
Post a Comment