Order Send and Traders Time

Back to topics list To post a new topic, please log in or register
avatar
23
Memma30 2015.08.06 12:56
 

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 


avatar
12985
WHRoeder 2015.08.06 14:06 #
 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Check your return codes (OrderSend) and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
avatar
12985
WHRoeder 2015.08.06 18:09 #
 
Memma30: Pls any suggestions
Learn to READ.
  1. Original post - not edited
  2. Duplicate post - no SRC
  3. Check return codes - suggestion ignored

avatar
Moderator
3405
GumRai 2015.08.07 01:09 #
 
 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

Back to topics list  

To add comments, please log in or register