Download MetaTrader 5

Code Help, Please Clarify - page 2

To add comments, please log in or register
Fernando Carreiro
2320
Fernando Carreiro  
angevoyageur:

False. It will be converted on today's date+hour like D'2016.04.18 01:30:00' for example.

Please do me a favour and first read the documentation, that you referenced. 
I stand corrected! However, in my defense, the documentation does not explicitly say that it will use today's date and and in fact it does imply the use of  "01.01.1970" when there is not a date present.
Alain Verleyen
Moderator
32810
Alain Verleyen  
FMIC:
I stand corrected! However, in my defense, the documentation does not explicitly say that it will use today's date and and in fact it does imply the use of  "01.01.1970" when there is not a date present.
You should be more open and not so much on the defensive, there is nothing bad making an error. It's not normal I have to repeat it 3 times for you to listen.
mikegreen
285
mikegreen  

ok thanks all... 

#property strict

extern int
   StartHour =  1,    
   StopHour  = 21;

void OnTick()
{
   int CurrentHour = Hour(); // Assigned, just in case it is not buffered and the hour changes between calls
   
   if( ( CurrentHour >= StartHour ) && ( CurrentHour <= StopHour ) )
   {
      // Do Something Here
   } 

I will attempt to get it to work  

Fernando Carreiro
2320
Fernando Carreiro  
angevoyageur:
You should be more open and not so much on the defensive, there is nothing bad making an error. It's not normal I have to repeat it 3 times for you to listen.

I would offer you the same advice as you have demonstrated the same "defensiveness" on another thread here where I too had to repeat myself several times to you!

So, lets call this hostility between us as "quits"! I will not be posting anything further today!

whroeder1
15712
whroeder1  
mickeyferrari: what about this?
extern string StartTrade_A="15:00";
:
if((now >= StringToTime(StartTrade) && ...
FMIC: Your strings will convert as being on January 1st, 1970 which will obviously not match the current date.
  1. That will work (ignoring roll over to a new day.)
  2. No date is given, current date is used. When in doubt, test it.
    void OnStart(){ 
       Print(StringToTime("10:13"));
    
    // 2016.04.18 13:49:19.567 testscr EURUSD,H1: 2016.04.18 10:13:00
    
12
To add comments, please log in or register