plot and study news on chart - page 2

 

Did you download the version from Donna Forex forum ??

About time it is for me correctly

I told it takes the localtime from your pc

do you have summertime clock change an hour ??

then if you have set your pc to change it automatically it will do this also in the code

it will find the gmt at gmt the newslines are


   int    TimeArray[4];
   int    TZInfoArray[43];
   int    nYear,nMonth,nDay,nHour,nMin,nSec,nMilliSec;
   string sMilliSec;
   

   
   GetLocalTime(TimeArray);
//---- parse date and time from array
   nYear=TimeArray[0]&0x0000FFFF;
   nMonth=TimeArray[0]>>16;
   nDay=TimeArray[1]>>16;
   nHour=TimeArray[2]&0x0000FFFF;
   nMin=TimeArray[2]>>16;
   nSec=TimeArray[3]&0x0000FFFF;
   nMilliSec=TimeArray[3]>>16;
   string LocalTimeS = FormatDateTime(nYear,nMonth,nDay,nHour,nMin,nSec);
   datetime localTime = StrToTime( LocalTimeS );
   //-----------------------------------------------------  
     GMTs = TimeToString( GMT );
   string locals = TimeToString( localTime  );

   string brokers = TimeToString( CurTime() );
   string bars = TimeToStr( CurTime() - Time[0], TIME_MINUTES );



   int gmt_shift=0;
   int dst=GetTimeZoneInformation(TZInfoArray);
   if(dst!=0) gmt_shift=TZInfoArray[0];
   if(dst==2) gmt_shift+=TZInfoArray[42];

   GMT = localTime + gmt_shift * 60;
   

   time_zone_gmt = -(gmt_shift/60);   
   

   DisplayTodaysNews();  

if the code is attached to the chart it finds the time_zone_gmt

Before you wrote the code had not be updated so what is good and what is bad news ???

 
See my TimeGmt()
 

ok Goodnews/Badnews is when the integer in the COLUMN_ACTUAL is greater or lower in the COLUMN_FORECAST;

Good/Badusd for example is when the integer in the COLUMN_ACTUAL is greater or lower in the COLUMN_FORECAST and when we select only to show USD CURRENCY.

But to avoid the mishmash, I think it is easier to do manual modification of csv file and in the end have instead of just HIGH or LOW or MEDIUM IMPORTANCE the GOODUSDHIGH/BADUSDHIGH, GOODUSDMEDIUM/GOODUSDMEDIUM...and in the end just pick from the settings in MT4 what line we want to plot :

extern bool show_goodusdhigh_news= true;

extern color news_goodusdhigh_color= Pink;

etc...

but what shall I do next ?

 
samuel2013:



Every object has its name now it is like

NewsLine67 NewsText88

every week you will get this if you want to display objects for over a week

you need to give it a unique name how you gonna do that ??

To make this work easier remove the clock part ....

 

Hey about the clock part, please explain how the indic is designed to work ? Correct me if I'm wrong :

- read broker time, read local time...add the difference of these two values to the news time downloaded from dailyFX, so that the broker time is taken in account .

Where can I read some tuitions on internet to understand your code ?

Kind Regards,

 
Hye I've been trying to plot news from a txt file but the coe has lot of issues : 
1) When I delete the indicator, the lines doesn't disappear. Tried to use int deinit function but doesn't work (don't know how to do it)
2) with time few lines disappears, and few gets offset and appears one on top of another at wrong dates on the MT4 chart ! 
3) for the rest it seems ok
Files:
news.mq4  4 kb
week.txt  3 kb
 
samuel2013:

Try this:

void OnDeinit(const int reason)

{
  ObjectsDeleteAll();
  return;
}
Reason: