Trading at Specific Hour in MT5

johnnybegoode

Trader
Jul 19, 2016
56
0
22
47
It works from 12pm to 10pm
but how to make it work overnight?
i.e from today 7pm to 5am tomorrow.

&& ((dt_struct.hour >= 19) && (dt_struct.hour < 5))
does not work.
No trades made.
 
Last edited:

Enivid

Administrator
Staff member
Nov 30, 2008
19,246
1,507
144
Odesa
www.earnforex.com
&& ((dt_struct.hour >= 19) && (dt_struct.hour < 5))
Such condition can never be true because, obviously, the same number cannot be greater or equal to 19 and lesser than 5. You have to swap the AND condition (&&) for OR condition here (||). You want the hour to be either greater or equal to 19 or less than 5.