Automatic Validation fail with datetime parameters

 

My EA set pending orders for datetime. All other functions are working well with my Strategy Tester and Real MT4 Platform. I am again saying my EA 100% working well with my Broker. But when i upload to Automatic Validation process it fail to validate the EA. Please look that codes.


extern datetime date1 = D'2017.11.23 15:30:00'; //Time


void start()
  {

if(TimeCurrent() < date1 && TimeCurrent() >date1 -5*60 && !PendingExcist())
               if(CheckMoneyForTrade(Symbol(),newlot,OP_BUY)==false)
                  {
                  Alert("Your account is not enough margin to buy!");
                  return;
                  }
               else
               {
                  Print("Opening pending orders...");
                  SetPending();
               }


}


Testing Result is:

test on EURUSD,H1
there are no trading operations
test on NZDUSD,H1
there are no trading operations
test on GBPUSDcheck,M30
there are no trading operations
test on XAUUSDcheck,Daily
there are no trading operations



I hope something wrong with: "date1". 

I need some help to fix this problem.
Thank you.

 
  1. When you post code please use the SRC button! Please edit your post.
              General rules and best pratices of the Forum. - General - MQL5 programming forum

  2. extern datetime date1 = D'2017.11.23 15:30:00'; //Time
    
    if(TimeCurrent() < date1 && TimeCurrent() >date1 -5*60 && !PendingExcist()) 
    Of course it doesn't work because the current time isn't  between 10:30 and 15:30 on 11/23 and never will be.
 
so what to do?
 

Obviously remove the date ?

2017.11.23
 
Marco vd Heijden: Obviously remove the date ?

That won't work, all you'd get is the date of compile.

Thushara Dissanayake: so what to do?

How should we know? You haven''t stated what you want it to do. If you want it to work only between 10:30 and 15:30, put those in a string and convert them to datetimes.

Reason: