Download MetaTrader 5
To add comments, please log in or register
Write your articles using our editor. It is convenient!
Carl Schreiber
5957
Carl Schreiber 2014.02.27 19:17 

Hi,

to calc the NY-Session I use:

11    #define ClsSess           57600 // = 16*3600 = 16h
      ...
55    datetime secLeftInNY(){
         ...
58       datetime tNY = getNYTime(TimeGMT());
59       if ( TimeDayOfWeek(tL)>0 && TimeDayOfWeek(tL)<6 && TimeHour(tL) >=8 && TimeHour(tL) < 16 ) 
60           return( (datetime)86400*MathFloor(tNY/86400) + (datetime)ClsSess - tNY );
61       return((datetime)-1);
62    }

The numbers are the line nubmers.

The warning is:

possible loss of data due to type conversion    TimeShifts.mqh  60      3

I get the same warning even before I added all the (datetime)-casting.

Why do I get this warning on the expression being returned?

Gooly


I got it this is ok - no warning:

return( (datetime)(86400*MathFloor(tNY/86400) + ClsSess - tNY) );
whroeder1
13640
whroeder1 2014.02.27 23:35  
     return( (datetime)86400*MathFloor(tNY/86400) + (datetime)ClsSess - tNY );
tNY/86400 is a datetime/int try
return( 86400*((ulong)tNY/86400) + ClsSess - tNY );
/
To add comments, please log in or register