设为首页 收藏本站 切换语言

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

| 发表于 2021-11-15 10:30:33 | 显示全部楼层 |复制链接
forexprostools抓取新闻写法
  1. void News_forexprostools()
  2.   {
  3.    if(IsTesting())return;
  4.    string cookie=NULL,headers,str3;
  5.    char post[],result[],figli[];
  6.    int res;
  7.    new_i=0;
  8.    ArrayFree(news_time);
  9.    string google_url="http://ec.forexprostools.com";
  10.    ResetLastError();
  11.    int timeout=5000; //--- timeout менее 1000 (1 сек.) недостаточен при низкой скорости Интернета
  12.    res=WebRequest("GET",google_url,cookie,NULL,timeout,post,0,result,headers);
  13.    if(res==-1)
  14.      {
  15.       Print("Error in WebRequest. Error code =",GetLastError());
  16.       //--- возможно, URL отсутствует в списке, выводим сообщение о необходимости его добавления
  17.       MessageBox("You must add an address '"+google_url+"' to the list of allowed URL on the tab 'Expersts'","Error",MB_ICONINFORMATION);
  18.      }
  19.    string str1=StringSubstr(Symbol(),0,3);
  20.    string str2=StringSubstr(Symbol(),3,3);
  21.    datetime news1;
  22.    j=0;
  23.    while(j<ArraySize(result)-10)
  24.      {
  25.       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")
  26.         {
  27.          jj=j;
  28.          while(jj<ArraySize(result)-10)
  29.            {
  30.             if(CharToStr(result[jj])+CharToStr(result[jj+1])+CharToStr(result[jj+2])+CharToStr(result[jj+3])+CharToStr(result[jj+4])=="</tr>")
  31.               {
  32.                sila=0;
  33.                Draw=false;
  34.                jjj=j;
  35.                while(jjj<jj)
  36.                  {
  37.                   if(CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])+CharToStr(result[jjj+3])+CharToStr(result[jjj+4])=="yFull")
  38.                     {
  39.                      sila++;
  40.                     }
  41.                   jjj++;
  42.                  }
  43.                jjj=j;
  44.                while(jjj<jj)
  45.                  {
  46.                   if(
  47.                      CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])==str1 ||
  48.                      CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])==str2
  49.                      )
  50.                     {
  51.                      Draw=true;
  52.                     }
  53.                   jjj++;
  54.                  }
  55.                jjj=j;
  56.                if(Draw)
  57.                  {
  58.                   while(jjj<jj)
  59.                     {
  60.                      if((sila==1 && NewsWeak) || (sila==2 && NewsMedium) || (sila==3 && NewsStrong))
  61.                        {
  62.                         if(CharToStr(result[jjj])+CharToStr(result[jjj+1])+CharToStr(result[jjj+2])+CharToStr(result[jjj+3])+CharToStr(result[jjj+4])=="tamp=")
  63.                           {
  64.                            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])+
  65.                                 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])+
  66.                                 CharToStr(result[jjj+21])+CharToStr(result[jjj+22])+CharToStr(result[jjj+23])+CharToStr(result[jjj+24]);
  67.                            StringReplace(str3,"-",".");
  68.                            news1=StrToTime(str3);
  69.                            news1=news1+TimeSetting*3600;
  70.                            str3=TimeToString(news1,TIME_DATE|TIME_MINUTES|TIME_SECONDS);
  71.                            ArrayResize(news_time,new_i+1);
  72.                            news_time[new_i]=news1;
  73.                            new_i++;
  74.                            ObjectDelete(_Name+"_"+IntegerToString(new_i)+"_"+str3);
  75.                            if(ObjectCreate(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJ_TREND,0,news1,0,news1,Bid))
  76.                              {
  77.                               ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_COLOR,ColorNews);
  78.                               ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_STYLE,LineStyle);
  79.                               ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_RAY_RIGHT,true);
  80.                               ObjectSetInteger(0,_Name+"_"+IntegerToString(new_i)+"_"+str3,OBJPROP_SELECTABLE,false);
  81.                              }
  82.                            else
  83.                               Print(GetLastError());
  84.                           }
  85.                        }
  86.                      jjj++;
  87.                     }
  88.                  }
  89.                jj=ArraySize(result);
  90.               }
  91.             jj++;
  92.            }
  93.         }
  94.       j++;
  95.      }
  96.   }
复制代码
求这段代码的完整版,望万能的汇友帮助
举报

评论 使用道具

精彩评论10

latage
未及格
| 发表于 2021-11-15 12:01:01 | 显示全部楼层
谢谢分享
举报

点赞 评论 使用道具

daerwushen
DD
| 发表于 2021-11-15 19:35:06 | 显示全部楼层
谢谢分享
举报

点赞 评论 使用道具

你是我的小脑被
DDD
| 发表于 2021-11-16 08:22:40 | 显示全部楼层
感谢分享
举报

点赞 评论 使用道具

eahuwho4433
D
| 发表于 2021-11-30 12:34:18 | 显示全部楼层
感谢分享
举报

点赞 评论 使用道具

zhq320
DD
| 发表于 2021-11-30 13:00:54 | 显示全部楼层
感谢分享
举报

点赞 评论 使用道具

EA88
DD
| 发表于 2021-11-30 22:45:11 | 显示全部楼层
谢谢分享
举报

点赞 评论 使用道具

EA1314
D
| 发表于 2021-11-30 22:55:51 | 显示全部楼层
每天签到,赚取积分
举报

点赞 评论 使用道具

tianping
DDD
| 发表于 2021-12-1 09:28:25 | 显示全部楼层
感谢分享
举报

点赞 评论 使用道具

ketion98
未及格
| 发表于 2022-2-11 18:47:53 | 显示全部楼层
每天签到,赚取积分
举报

点赞 评论 使用道具

wzm
DD
| 发表于 2023-5-23 08:56:24 来自手机 | 显示全部楼层
积分积分
举报

点赞 评论 使用道具

发新帖
EA交易
您需要登录后才可以评论 登录 | 立即注册

andyzhang0716

andyzhang0716 DD

赚钱本不易,开发公益EA,感谢大家捐赠

天眼云VPS
简体中文
繁體中文
English(英语)
日本語(日语)
Deutsch(德语)
Русский язык(俄语)
بالعربية(阿拉伯语)
Türkçe(土耳其语)
Português(葡萄牙语)
ภาษาไทย(泰国语)
한어(朝鲜语/韩语)
Français(法语)