找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
首页论坛EAHub 外汇论坛
查看: 9|回复: 0

求一段新闻过滤源码(非调用)

[复制链接]

4万

主题

54

回帖

4万

积分

管理员

积分
45954
发表于 2026-8-23 06:26:00 | 显示全部楼层 |阅读模式
forexprostools抓取新闻写法


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++;
     }
  }复制代码求这段代码的完整版,望万能的汇友帮助
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|EAHub外汇论坛

GMT+8, 2026-10-12 02:35 , Processed in 0.434156 second(s), 19 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表