(Forex, MQL4, Metatrader)

 

: http://www.dailyfx.com/calendar/ *.csv . files . . , . . (, ).

 

#property copyright "Shumi"

#property link ""

 

extern int xTime=27; //time for EA to wait for news to be released

 

int start()

{

Alert("Set News");

int z = DownloadCalendar();

 

return(0);

}

//+------------------------------------------------------------------+

int DownloadCalendar()

{

double pips = 0, t_shift = 0; // ,

int count = 0, simv_find;

string stDate1,stTime1, stTimeZone1, stCurrency1, stDescription1, stImportance1, stActual1, stForecast1, stPrevious1, graph_text;

datetime vremya, prev = 0;

int file1 = FileOpen("Calendar.csv",FILE_CSV|FILE_READ,',');

while (!FileIsEnding(file1))

{

stDate1=FileReadString(file1);

if (stDate1 != "")

{

stTime1 = FileReadString(file1);

vremya = ToDate(stDate1, stTime1);

int shift = iBarShift(NULL,0,vremya); // datetime

stTimeZone1 = FileReadString(file1);

stCurrency1 = FileReadString(file1);

string simv = Symbol();

simv_find = StringFind(simv, StringTrimRight(StringTrimLeft(stCurrency1)),0);

stDescription1 = FileReadString(file1);

stImportance1 = FileReadString(file1);

//

if (StringFind(stImportance1, "Low", 0) > -1)

{count++;ObjectCreate(DoubleToStr(count,0),OBJ_ARROW,0,vremya,High[shift]+pips);ObjectSet(DoubleToStr(count,0),OBJPROP_ARROWCODE,68);}

if (StringFind(stImportance1, "High", 0) > -1)

{count++;ObjectCreate(DoubleToStr(count,0),OBJ_ARROW,0,vremya,High[shift]+pips);ObjectSet(DoubleToStr(count,0),OBJPROP_ARROWCODE,67);}

pips = pips + 0.0002;

stActual1 = FileReadString(file1);

stActual1 = StringTrimRight(StringTrimLeft(stActual1));

stForecast1 = FileReadString(file1);

stForecast1 = StringTrimRight(StringTrimLeft(stForecast1));

stPrevious1 = FileReadString(file1);

stPrevious1 = StringTrimRight(StringTrimLeft(stPrevious1));

graph_text = stDescription1 + ";" + stActual1 + ";" + stForecast1 + ";" + stPrevious1;

count++;

//ObjectCreate(graph_text,OBJ_TEXT,0,vremya,High[shift]+ pips);

//ObjectSetText(graph_text,graph_text,8,"Arial", White);

//

//ObjectCreate(DoubleToStr(count,0),OBJ_VLINE,0,vremya+t_shift,0,0,0);

ObjectCreate(graph_text,OBJ_VLINE,0,vremya+t_shift,0,0,0);

if (simv_find > -1) //

{

if (StrToDouble(stPrevious1) != 0 && (StrToDouble(stForecast1) != 0))

{

if (((StrToDouble(stForecast1)>=StrToDouble(stPrevious1)) && (simv_find < 3)) || ((StrToDouble(stForecast1) < StrToDouble(stPrevious1)) && (simv_find > 2)))

{

ObjectSet(graph_text,OBJPROP_COLOR,Red); //

}

else if (((StrToDouble(stForecast1)<=StrToDouble(stPrevious1)) && (simv_find < 3)) || ((StrToDouble(stForecast1) > StrToDouble(stPrevious1)) && (simv_find > 2)))

{

ObjectSet(graph_text,OBJPROP_COLOR,White); //

}

else

{

ObjectSet(graph_text,OBJPROP_COLOR,Lime); //,

}

}

else

{

ObjectSet(graph_text,OBJPROP_COLOR,Blue); //,

}

}

else

{

ObjectSet(graph_text,OBJPROP_COLOR,Gray); // ,

}

//

if (StringLen(stActual1) > 0)

{

if (((StrToDouble(stActual1) >= StrToDouble(stForecast1)) && (simv_find < 3)) || ((StrToDouble(stActual1) < StrToDouble(stForecast1)) && (simv_find > 2))) //

{

ObjectCreate(DoubleToStr(count,0),OBJ_ARROW,0,vremya + 3,High[shift]+pips);ObjectSet(DoubleToStr(count,0),OBJPROP_ARROWCODE,241); //

}

if (((StrToDouble(stActual1) < StrToDouble(stForecast1)) && (simv_find > 2)) || ((StrToDouble(stActual1) >= StrToDouble(stForecast1)) && (simv_find < 3)))

{

ObjectCreate(DoubleToStr(count,0),OBJ_ARROW,0,vremya + 3,High[shift]+pips);ObjectSet(DoubleToStr(count,0),OBJPROP_ARROWCODE,242); //

}

}

if (vremya == prev) {pips = pips + 0.0002;t_shift = t_shift+60;}

else {pips = 0; t_shift = 0;}

prev = vremya;

count++;

}

}

//WinExec(GetrightAdress+" /URL:"+HtmlAdress+" /FILE:Calendar.csv /W /O",0);

FileClose(file1);

return (1);

}

//------------------------------------------------------------------------

datetime ToDate(string stDate,string stTime)

{

//

string Mes = StringSubstr(stDate,4,3);

string MesNum = 0;

if (Mes=="Jan") MesNum="01";

if (Mes=="Feb") MesNum="02";

if (Mes=="Mar") MesNum="03";

if (Mes=="Apr") MesNum="04";

if (Mes=="May") MesNum="05";

if (Mes=="Jun") MesNum="06";

if (Mes=="Jul") MesNum="07";

if (Mes=="Aug") MesNum="08";

if (Mes=="Sep") MesNum="09";

if (Mes=="Oct") MesNum="10";

if (Mes=="Nov") MesNum="11";

if (Mes=="Dec") MesNum="12";

int DayNum = StrToInteger(StringSubstr(stDate,8));

string Dat = "2010." + MesNum + "." + DoubleToStr(DayNum,0);

//

int ind = StringFind(stTime, " ",0);

string tt = StringSubstr(stTime,0,ind);

string Vozvrat = Dat + " " + tt;

datetime TD = StrToTime(Vozvrat) + 2*60*60; // 2 - MetaTradera

//Alert(TD);

return (TD);

}

:
" ":

:
:
Profit/Loss :
MACD:
:

()




@Mail.ru

 
 
:
VBA -2014
, E-mail: apsheronka@mail.ru
,


http://apsheronsk.bozo.ru - !


LF igr dlya