Why is the news indicator not working in Windows 7? - page 3

 
see my personal email, but it's only for this week
 

is that what it's supposed to look like?

Files:
news_1.mq4  18 kb
 
Abzasc:

is this what it's supposed to look like?


Well, roughly ) Only it looks like you have line labels duplicated in each subwindow.
 
alexx_v:
Well roughly ) Only you seem to have line lettering duplicated in each subwindow.

Then it's easier to open a separate window for the indicator :) I don't know where to change, I'll try tomorrow.

Also thinking like Mischek. The file is now called Calendar-08-01-2010.csv, so I will have to copy a new address here every week

and change in the code in this piece

// -----------------------------------------------------------------------------------------------------------------------------
string LoadNews(datetime curr_time)
{ 
  bool reload = false;
  int pos = 0, pos1 = 0;
  int file = 0, file2 = 0;
  string str = "", str2 = "";
// ---------- название ФАЙЛА
  file = FileOpen("Calendar-08-01-2010.csv", FILE_BIN|FILE_READ);
  if(file!=-1)
  {
    FileClose(file); 
// ---------- название ФАЙЛА
    str2 = ReadFile("Calendar-08-01-2010.csv");
        
    pos = StringFind(str2, "\n");
    int cache_time = StrToTime(StringSubstr(str2, 0, pos));
    str2 = StringSubstr(str2, pos+2);

    if(cache_time<=curr_time-update*60) reload = true;
  }
  else reload = true;

  LastUpdate = curr_time;
  if(reload)
  {
// ---------- АДРЕС
    str = ReadWebPage("http://cdn.dailyfx.com/files/Calendar-08-01-2010.csv?week=&sort=dateDesc&timezone=&currency=|&importance=|&time="+curr_time);
    if(str == "") return(0);
    Str_Replace("\n\n", "\n", str);
    str = StringTrimRight(str);

// ---------- название ФАЙЛА
    WriteFile("Calendar-08-01-2010.csv", TimeToStr(curr_time, TIME_DATE|TIME_SECONDS)+"\n"+str);
  }  
  else
    str = StringTrimRight(str2);
  return (str);  
}

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

upgrade

Missed in one place, though it worked :)

Files:
news_2.mq4  18 kb
 

No, no, no...

// -----------------------------------------------------------------------------------------------------------------------------
string LoadNews(datetime curr_time)
{ 
  bool reload = false;
  int pos = 0, pos1 = 0;
  int file = 0, file2 = 0;
  string str = "", str2 = "";
// ---------- название ФАЙЛА
  file = FileOpen("news.csv", FILE_BIN|FILE_READ);
  if(file!=-1)
  {
    FileClose(file); 
// ---------- название ФАЙЛА
    str2 = ReadFile("news.csv");
        
    pos = StringFind(str2, "\n");
    int cache_time = StrToTime(StringSubstr(str2, 0, pos));
    str2 = StringSubstr(str2, pos+2);

    if(cache_time<=curr_time-update*60) reload = true;
  }
  else reload = true;

  LastUpdate = curr_time;
  if(reload)
  {
// ---------- АДРЕС
    str = ReadWebPage("http://cdn.dailyfx.com/files/Calendar-08-01-2010.csv?week=&sort=dateDesc&timezone=&currency=|&importance=|&time="+curr_time);
    if(str == "") return(0);
    Str_Replace("\n\n", "\n", str);
    str = StringTrimRight(str);
    WriteFile("news.csv", TimeToStr(curr_time, TIME_DATE|TIME_SECONDS)+"\n"+str);
  }  
  else
    str = StringTrimRight(str2);
  return (str);  
}

// -----------------------------------------------------------------------------------
I think that's what we should do, otherwise we read the data and write them into news.csv, and then try to read from Calendar-08-01-2010.csv, but did we save it somewhere?
 
There, it's good that I missed it ). For I don't think it's worth changing, because now it would be easier to make a "crutch" - an external variable, where to write the new date at the beginning of the new week and substitute it in the query address by hand
 
alexx_v:

No, no, no...

I think that's what we should do, otherwise we read the data and write them into news.csv, and then try to read from Calendar-08-01-2010.csv, but did we save it somewhere?
It doesn't work that way, that's how I started :)
 
alexx_v:
There, it's good that I missed it ). For I don't think it's worth changing, because now it would be easier to make a "crutch" - an external variable, where to write the new date at the beginning of the new week and substitute it in the query address by hand
Yes, probably the easiest option.
 
Abzasc:
It doesn't work like that, that's where I started :)
Hmmm. Returned news.csv - restarted - worked... Wonderful :)
 

here we go:

extern string кастыль= "08-01-2010";

and the query address accordingly:

str = ReadWebPage("http://cdn.dailyfx.com/files/Calendar-"+кастыль+".csv?week=&sort=dateDesc&timezone=&currency=|&importance=|&time="+curr_time);

seems to be working, so long as we can get by with this.

---

Now it's doing all the news for all currencies, the old filter is not working.

Reason: