Order Send and Traders Time

 

hello, if i have to link Trader's choice of Time to trade with  OrderSend in EA  using the  following
code: 

 

 

          TIME:

  bool TradeTime=false;

    if (Hour()>StartHour)&&(Hour()<EndHour))

          || (Hour()==StartHour&&Minute()>=StartMinute)
           || (Hour()==EndHour&&Minute()<EndMinute)
)
        TradeTime=true;


   [ORDERSEND].

int ms = GetTickCount ();
      tick = OrderSend (Symbol (), dir, lots, price, use_slp, use_sl, use_tp, "", magic_number) ;
      placing the following can the Traders Time be executed on EA.

 

(The trader has to select a specific time to trade.)


 Still not getting the result. Pls any suggestions 


 
Memma30: Pls any suggestions
Learn to READ.
  1. Original post - not edited
  2. Duplicate post - no SRC
  3. Check return codes - suggestion ignored
 
 if (Hour()>StartHour)&&(Hour()<EndHour))
 
 //Is the same as

 if (Hour()>StartHour)
     &&(Hour()<EndHour))

Sort out your () brackets as they are not correctly placed. Does your code even compile?

 

  if((Hour()>StartHour && Hour()<EndHour)
      || (Hour()==StartHour && Minute()>=StartMinute)
      || (Hour()==EndHour && Minute()<EndMinute))

is better. Your code does not take into account if the session period passes through midnight