Download MetaTrader 5
To add comments, please log in or register
Improve your rating. Execute orders in Freelance service!
MThomp
63
MThomp 2015.08.06 10: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 


whroeder1
13627
whroeder1 2015.08.06 12: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
whroeder1
13627
whroeder1 2015.08.06 16:09  
Memma30: Pls any suggestions
Learn to READ.
  1. Original post - not edited
  2. Duplicate post - no SRC
  3. Check return codes - suggestion ignored
Keith Watford
Moderator
7955
Keith Watford 2015.08.06 23: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

/
To add comments, please log in or register