Download MetaTrader 5

#property strict warning Possible loss of data due to type conversion

To add comments, please log in or register
digisoft
984
digisoft  

The code:

int candle_time_left = current_bartime + entry_signal_period_seconds - TimeCurrent();

gives warning with #property strict

How should I programm it correct?

Any help appreciated !

Alain Verleyen
Moderator
33504
Alain Verleyen  
whroeder1
16108
whroeder1  
int candle_time_left =  current_bartime + entry_signal_period_seconds - TimeCurrent() ;
                            datetime    +   int                       - datetime
                                     datetime                         - datetime
 int                 =                                  long // Possible loss of data due to type conversion

a datetime minus a datetime is a long.

int candle_time_left = int( current_bartime + entry_signal_period_seconds - TimeCurrent() );
digisoft
984
digisoft  

WHRoeder, you made my day... ;-)


Thank you.

To add comments, please log in or register