I put the following code into an EA for the following reasons:
a) If day is Monday: only open new trades after 9am ( broker/Empty4 platform time)
b) If day is Friday: only open new trades before 3pm ( broker/Empty4 platform time)
c) If day is Tue, Wed, or Thur: open new trades any time
However, this last Fri (15th), the EA opened new trades after 3pm
What was wrong with the code below?
Thanks
Code: Select all
int DoW = TimeDay(TimeCurrent());
int currentHour = TimeHour(TimeCurrent());
if ( 1 < DoW < 5 ) // It's not Monday or Friday
{
// open new trade
}
if ( DoW == 1 && currentHour > 9 ) // It's Monday after Asian session
{
// open new trade
}
if ( DoW == 5 && currentHour < 15 ) // It's Friday before NY session
{
// open new trade
}