void News_forexprostools()
{
if(IsTesting())return;
string cookie=NULL,headers,str3;
char post[],result[],figli[];
int res;
new_i=0;
ArrayFree(news_time);
string google_url="http://ec.forexprostools.com";
ResetLastError();
int timeout=5000; //--- timeout менее 1000 (1 сек.) недостаточен при низкой скорости Интернета
res=WebRequest("GET",google_url,cookie,NULL,timeout,post,0,result,headers);
if(res==-1)
{
Print("Error in WebRequest. Error code =",GetLastError());
//--- возможно, URL отсутствует в списке, выводим сообщение о необходимости его добавления
MessageBox("You must add an address '"+google_url+"' to the list of allowed URL on the tab 'Expersts'","Error",MB_ICONINFORMATION);
}
string str1=StringSubstr(Symbol(),0,3);
string str2=StringSubstr(Symbol(),3,3);
datetime news1;
j=0;
while(j<ArraySize(result)-10)
{
if(CharToStr(result[j])+CharToStr(result[j+1])+CharToStr(result[j+2])+CharToStr(result[j+3])+CharToStr(result[j+4])+CharToStr(result[j+5])+CharToStr(result[j+6])+CharToStr(result[j+7])+CharToStr(result[j+8])+CharToStr(result[j+9])=="eventRowId")
{
jj=j;
while(jj<ArraySize(result)-10)
{
if(CharToStr(result[jj])+CharToStr(result[jj+1])+CharToStr(result[jj+2])+CharToStr(result[jj+3])+CharToStr(result[jj+4])=="</tr>")
{
sila=0;
Draw=false;
jjj=j;
while(jjj<jj)
{
if(CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])+CharToStr(result[jjj+3])+CharToStr(result[jjj+4])=="yFull")
{
sila++;
}
jjj++;
}
jjj=j;
while(jjj<jj)
{
if(
CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])==str1 ||
CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])==str2
)
{
Draw=true;
}
jjj++;
}
jjj=j;
if(Draw)
{
while(jjj<jj)
{
if((sila==1 && NewsWeak) || (sila==2 && NewsMedium) || (sila==3 && NewsStrong))
{
if(CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])+CharToStr(result[jjj+3])+CharToStr(result[jjj+4])=="tamp=")
{
str3=CharToStr(result[jjj+6])+CharToStr(result[jjj+7])+CharToStr(result[jjj+8])+CharToStr(result[jjj+9])+CharToStr(result[jjj+10])+CharToStr(result[jjj+11])+CharToStr(result[jjj+12])+CharToStr(result[jjj+13])+
CharToStr(result[jjj+14])+CharToStr(result[jjj+15])+CharToStr(result[jjj+16])+CharToStr(result[jjj+17])+CharToStr(result[jjj+18])+CharToStr(result[jjj+19])+CharToStr(result[jjj+20])+
CharToStr(result[jjj+21])+CharToStr(result[jjj+22])+CharToStr(result[jjj+23])+CharToStr(result[jjj+24]);
StringReplace(str3,"-",".");
news1=StrToTime(str3);
news1=news1+TimeSetting*3600;
str3=TimeToString(news1,TIME_DATE|TIME_MINUTES|TIME_SECONDS);
ArrayResize(news_time,new_i+1);
news_time[new_i]=news1;
new_i++;
ObjectDelete(_Name+"_"+IntegerToString(new_i)+"_"+str3);
if(ObjectCreate(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJ_TREND,0,news1,0,news1,Bid))
{
ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_COLOR,ColorNews);
ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_STYLE,LineStyle);
ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_RAY_RIGHT,true);
ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_SELECTABLE,false);
}
else
Print(GetLastError());
}
}
jjj++;
}
}
jj=ArraySize(result);
}
jj++;
}
}
j++;
}
}
发表评论