Download MetaTrader 5

Date Variables problem.

To add comments, please log in or register
Baptiste George
528
Baptiste George  
Hi,


I have 1 variable times created this way: (picture attached)

I need to calculated the time between now and the last time a news time came out.

when I do this way... it works nicely:

Print((TimeGMT() - GV_FxCal_News1)/60);
=> I got the time in minutes.

This is working from the EA which creates the global variable called "GV_FxCal_News1"
datetime GV_FxCal_News1 = GlobalVariableGet("GV_FxCal_News1");


Problem is here:


Now, I need to get this as well into another EA.

But it doesn't work.



So I printed TimeGMT() and "GV_FxCal_News1"... they both get correct value.

When I do this:

Print((TimeGMT() - GV_FxCal_News1)/60);
I got weird result as

1970.01.01 00:00:15



Please help
Files:
honest_knave
Moderator
2293
honest_knave  

datetime variables store the seconds elapsed since 00:00 on 01 January 1970. 

   long diff_in_mins = (TimeGMT() - GV_FxCal_News1)/60;
   Print(diff_in_mins);


 

Baptiste George
528
Baptiste George  
honest_knave:

datetime variables store the seconds elapsed since 00:00 on 01 January 1970. 

   long diff_in_mins = (TimeGMT() - GV_FxCal_News1)/60;
   Print(diff_in_mins);


 

Perfect! Thank you
To add comments, please log in or register