Trade only certain times of day?

 

I have an EA that I want to trade only certain times of day. The EA is designed to trade only between 18 and 23 GMT and 0 to 9 GMT, but I can't seem to get it working correctly. I can get it trade between 18 and 23, but it won't generate any trades between 0 and 9. Here is part of the code:

------------------------------

if (UseHourTrade) {

if (!(Hour() >= StartHour1 && Hour() = StartHour2 && Hour() <= EndHour2)) {

Comment("Non-Trading Hours!");

--------------------------------

Anyone know what the problem could be? Your help would be greatly appreciated.

 
pipsweak:
I have an EA that I want to trade only certain times of day. The EA is designed to trade only between 18 and 23 GMT and 0 to 9 GMT, but I can't seem to get it working correctly. I can get it trade between 18 and 23, but it won't generate any trades between 0 and 9. Here is part of the code:

------------------------------

if (UseHourTrade) {

if (!(Hour() >= StartHour1 && Hour() = StartHour2 && Hour() <= EndHour2)) {

Comment("Non-Trading Hours!");

--------------------------------

Anyone know what the problem could be? Your help would be greatly appreciated.

Hi, you can do like this:

double Trade=0; (before int start)

then

if((Hour()>=StartHour1&&Hour()=StartHour2&&Hour()<=EndHour2)){

Comment("Let's Trade!)

Trade=1; (for example, and you put where the ea enter a trade, to enter only if Trade>0)

}

else {

Comment("Non-Trading Hours!");

Trade=0;

}

Maybe like this it work, i think.

Bye