Getting current date without time - page 2

 

the above code runs true for broker with 5 trading days right?

how about broker with 5.5 trading days? 

 
doshur:

let me compress the code a little

https://www.mql5.com/en/docs/basis/operations/mathoperation

smart use of % 

That is good pratice to use #define for constants, in the beginning of a program. If you have to change it, no need to search in the code.

 
doshur:

the above code runs true for broker with 5 trading days right?

how about broker with 5.5 trading days? 

It should work just as well as your original code,  will your original code do what you need it to do with a Broker that has Sunday trading ?
 
angevoyageur:

That is good pratice to use #define for constants, in the beginning of a program. If you have to change it, no need to search in the code.

I did learn some good habits while acquainting myself with mql4 ;-)
 
thanks all for the advice
 
I just notice that the code can easily mod to be trade once in a bar